This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!

Nuwan Hettiarachchi

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

Recent posts by Nuwan Hettiarachchi

I got through!!!

Thanks for JavaRanch for providing me a daily doze of questions and answers. I used to read posts in Javaranch and they were quite helpful and very thought provoking.

Thanks for the Kathy and Bert for their wonderful book. I got the Head-First version quite late, unless that would be my favourite for the exam.

A Big thank goes to Rajitha, Q500 and


14 years ago

My favourite analogy is to match the TV remote control with the TV.
TV remote control is the Reference Type,
TV is the actual object.

If TV remote has switches to operate the TV will function accordingly as the instruction (methods) implemented at run time.

You can add the Casting operations in the same analogy and get this story expanded. The advantage is once you know the story, it is easy to map it back to the real OBJECTS.


Thanks for the reply...

I think I have found the answer from you.

first we evaluate i - it's 0, and increment it (that's the i++)

1. Evaluate
2. Increment (adjust the value)
3. Use the adjusted value for the method call
4. Still i = i++ + (f1(i)); is evaluated with i's unadjusted value. so i= 0 + 1

My confusion was weather to use the adjusted value or not.

For the reply.
Hi all...
I'm confused with the following syntaxes. First of all I have noticed several posts regarding precedence in this forum and for some Bates has answered saying such topics will be rare in SCJP5.0 onwards. However, since this was a scenario that we have discussed in the class... Can some one give some insight on what is happening in this code. I have put my experimental results on the code saying what were my outputs.

I have tested for two scenarios,
1. with f1() returning 0;
2. with f1() returning i;

Based on the values I get; should I consider for Scenario 1,
i=i++ + (f1(i)) happened like i++ done first and then the incremented value is passed to f1(i) (That should be why I get 1 printed for this), and then again when assigning to i (i=part on Right hand side) the value that is incremented is not considered?

I hope I can figure out answers for other cases if I get my confusion cleared for this...

Thanks in advance.

Hi vijay,

As far as I know, these vouchers are sold on bulk, with attractive discounts for the resellers. However, they are valid for 1 year from issue date. When the expiration date gets closer, vouchers are sold at a lower price - at least to cover the cost. That happens in Sri Lanka.

Yes, in otherswords, Statis are for class level, so they exists always, loaded with class. Therefore, you cannot override such, since Vertual Method Invocation does not taken account in here...

I'm from Sri Lanka (it looks like you are from India, though), but to tell you, I got a voucher for 16650/-, from NetAssist. Sun is also giving Retake Vouchers these days.

What I have found out is.....
List<String> x1= new ArrayList<String>(); // Gen Gen OK
List<String> x2= new ArrayList(); // Gen NonGen Warning
List x3= new ArrayList<String>(); // NonGen Gen OK
List x4= new ArrayList(); // NonGen NonGen OK

Java allowed this... could be due to the same pattern occurs when you pass a Type Safe variable to a Non Type Safe method.