Help coderanch get a
new server
by contributing to the fundraiser

Paul Salerno

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

Recent posts by Paul Salerno

Case A

Case B

My question is why in case B we are accessing the method in the superclass vs the overridden method in Subclass and is this always the case.
round (double) < -- returns long
I was under the impression that methods of Math return either int or double.
Where am I wrong?
TIA
Could someone explain how this is different from my code?
Does anyone have a clue about the last piece of code that I posted.
4 string objects are being created and I wanted to be sure that they WILL be GC'd.
TIA
Is this the same situation?
Here 4 string literal objects are created within a for loop and GC'd since temp is a local var.
woops a typo, heres the code that should be:
chafule,


i is assigned to the returned value of getInt()
which returns k+1


I dont see any addition taking place here. What I do see is concatenation k + i where k is zero at that time. yes the return of the method is i but again where is this 1 at?
Thanks for your input Rick
I'm still unsure where this 1 is coming from
0 + 1
Yes I can see that K is 0, but how are we getting 1 for i ?
TIA
Duncan and Corey, yes that does make sense.
Im still not 100% on case 1 yet, if anyone knows.

A: initializing i to getInt() where k hasnt been initialized yet at this point, its zero. however, how is "1" being returned and printed?
B: prints ret value of method which is 1 and the value of k member var which is 20
I can see how this dg matrix holds two rg objects. Nevertheless since rg is set to null, the return value would be null, no?
Could you tell me if Case 1 is correct?
Corey this makes total sense. Thanks!