Ravikanth kolli

Ranch Hand
+ Follow
since Feb 10, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ravikanth kolli

The second case is not true because both Integer and Short are objects.

And cannot assign one to the other because Integer and Short are not related to each other.

Assigning one object to other can be done only if both there is an IS-A relation to between the objects as explained by cristian senchiu.

i tried eclipse in the very beginning and it worked pretty good.. I would go with eclipse
15 years ago
It is not a requirement but is considered as a best practice.
Having only one return statement for a method will make it more readable, while having many will only make the flow haphazard and difficult to understand.
15 years ago
As vierda was talking about covariant returns, the return type of a method in subclass should be subclass of the return type of the method in the super class. Animal is a super class of cat so it works fine, but int is not a super class of long.
The code works fine.
Why do you think that it should generate an exception?
well i think that creation of a new object in the method has actually shadowed the object that is passed as an argument. dont you think so?
yap that is what i assumed..


well lets start from line 12. AS there is a new object of Foo is created the value of barNum for that object is '0' .
then we have which passes the bar object as a reference.
In line 5 it prints the value of 99 as the value of barNum is changed to 99.
In line 6 a new object of Bar is created and thus the reference to the previous bar is lost for that variable, which now points to a new object.
In line 8 420 is printed since that is the value for the new bar object.

Now when we return to line 14 the value for barNum is going to be 99 since that is the last time the value has been changed for that object.

The object passed as an argument is shadowed by the creation of a new object in the method.



one of the most common question that can asked is related to the number of objects at a particular time in a given piece of code.
wow!! that is cool.. I lovee nutella..
15 years ago
well i think most of the plugins created for eclipse for general use are listed here.

there might be a lot more which are used privately.
Firstly,
welcome to javaranch.

This is a good place to start. It gives a clear idea about event listeners with examples.
15 years ago
what fred rosenberger actually means is to use the command line to write the output to the file when you run the class

>>Java classname > output_filename.txt
15 years ago