Uttara Rishi

Ranch Hand
+ Follow
since Feb 24, 2008
Merit badge: grant badges
For More
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 Uttara Rishi

Congrats prabhodh mekala .Way to go.



Uttara Rishi
16 years ago
Congrats Lata. Great score.




Uttara Rishi.
16 years ago
Congrats

Uttara Rishi
16 years ago
Hi Dinesh,

Here's the explanation

First whenever a constructor runs there is an implicit call to its super constructor in the first line itself if there is no call to the other overloaded constructors.

In your example, cert3 calls cert2 which calls cert1 which calls the Object constructor.

All the super constructor runs and then the subclass constructor constructor runs!

For a more detailed explanation checkout K & B.

Hope that helps.


Uttara Rishi.
Congrats


Uttara Rishi.
16 years ago
Congratulations .Way to go.
Thanks for your insight.

Uttara Rishi.
16 years ago
Congrats Milton.
Way to go.


Uttara Rishi.
16 years ago
Hi Ranchers,
Please consider the following code...




My question is why are we not getting a compilation error saying "Unreachable statement" citing line 1?

Can somebody please explain?
Thanks in advance.

Uttara Rishi.
Hi Nabila,
Here's the explanation.


int i = 10;
i = i++;
Internally:
temp = i // temp = 10;
i = i+ 1 // i = 11;
i = temp // i = 10;

whereas when
i = ++i;
temp = i // temp = 10;
i = i + 1 // i = 11;
i = i // i = 11;

Hope this clears it up.

Thanks Ninad.

Uttara Rishi.
[ March 12, 2008: Message edited by: Uttara Rishi ]
Hi Galina,


String[] x;
Object[] d = x; // d =null

Can anyone explain lines 4&5 please? What does d refer to?



d refers to a 1- D String array .Remember since d is a 1 - D it can only refer to a 1-d array or anything that can be implictly cast like


dog d = new dog();
Object[] obj ;
obj = {new dog(),d}; // Since dog IS - A Object.Arrays make use of polymorphism.

Hope that helped.For a more thorough understanding check K & B book.

Uttara Rishi.
[ March 11, 2008: Message edited by: Uttara Rishi ]
Thanks Rohit. That helped.



Murali wrote....
Integer as = 303;
long lo=303l;
System.out.println(as==lo); // Line 1

The compiler will throw error in line 1 as compiler cannot unbox Integer and Type case it to Long at the same time.

Have you tried to compile the above code? There is no issue with the above code and it compiles without any errors and prints o/p: true



Here we are talking about Integer and Long objects not the primitive long.
Hope that cleared it .


Uttara Rishi.
Thanks Kesava.That helped.


Uttara Rishi.
Congrats Christian. Way to go.



Uttara Rishi.
16 years ago
Thanks Rohit,



I still dont get it.
I think s1 and s2 both refer to the same object. Dont they...?
Please correct me if i m wrong.


Uttara Rishi.
Thanks for the correction Henry.



Uttara Rishi.