Top.Mail.Ru
March 6th, 2005 - Java developers — LiveJournal
? ?

Java developers

March 6th, 2005
 

03:17 pm - crasherkiddy - RMI

:( Java really isn't my language lol, i'm not having much luck with something i'm trying to get going in java RMI tbh i think my understanding of it is completly wrong. It'd be great if anyone could message me on msn and give me a quick hand (drziggy@hotmail.com). I'll trying and explain as best i can here.

I make a call from a user class like so....

try {

Account userAccount = pr.getAccount(accountNumber);
//userBalance = userAccount.getBalance();

}catch(RemoteException remoteException) {

System.err.println(remoteException);
System.exit(1);

}

... pr is the UnicastRemoteObject, this should in my mind return a whole hash table (which is an account) and put it in userAccount allowing me to call any of the functionality for that account e.g. userAccount.getBalance() etc however it doesn't i get a NullPointerException like it doesn't exist. What it does allow me to do is run them within the try so the line that is commented out actually works. Thing is then i just make one connection retrieving all of the variables i need, after that i need to edit the variables and update them on the server side, i can't do this though because i can't access the function i need in userAccount. Does that make sense?!

I'm completely lost here, spent ages trying to get my head around it.
 

03:25 pm - ex_bluelili

I need help trying to figure out how to use constructors...

In one example we are supposed to do the following:

You are given  a class named  Clock that has one int instance variable  called hours . Write a constructor  for the class  Clock that takes one parameter , an int  , and gives its value  to hours.


I just can't figure out how to take a parameter and assign it to "hours"??

In another example we had to:

You are given  a class named  Clock that has one int instance variable  called hours . Write a constructor  with no parameters  for the class  Clock . The constructor  should set hours to 12 .


Now, I get this...

Clock ()
{
hours = 12;
}


That's simple enough, but I can't seem to take the leap from there to take a parameter and give its value to hours. Maybe this is just me overthinking the whole situation, but any tips or assistance would be greatly appreciated.

Thanks,
Susan
 

07:27 pm - ex_juan_gan

Just did some benchmarks regarding comparing calling final vs non-final methods, both declared and inherited.

Details here: http://www.livejournal.com/users/ivan_ghandhi/200347.html

08:56 pm - bobbotron - Whats wrong with this ant line?

So I wrote a few unit tests for a project I'm writing: they all end in the text "Test": I want to exclude them from my project standard java ant build script.  I added the following bolded text to the excludes path of my ant script.  However, my unit test, AgentIDTest.java, that is defined a few packages deep, is still compiled with this addition to the task.  (And causes an error in the compile, as I'm not including JUnit into the javac task classpath.)

Any advice would be great.  :)

<javac srcdir="${src}" excludes="org/osgi/**/* org/ungoverned/oscar/**/* **/*Test.java" destdir="${build}" classpath="${osgi.jar.location}" />
Powered by LiveJournal.com