Raghu Doppalapudi

Greenhorn
+ Follow
since Jun 26, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Raghu Doppalapudi

very good question anil & thanks deepak for good explanation

In the above compareTo method it first checks whether the object passed is an instance of Person or not, if not an exception is thrown, if its an instance of person subtracts the age of another person from the current person age. it just gives the difference in the ages between the calling objects age and the object passed as argument to the method

If the code is as above works fine and prints clidlet.
In the code you posted you are trying to access private method which is not visible.
Vikas you declared the variable and assigned it. This works fine...
but with the previous the variable was not declared and how can you assign it??
For your second question the answer is option number 4
explanation:
first constructor initialize() is called and then this(10) call the constructor initialise(int) and then at last y=3 is executed.

So the output is 3