Pulamathi Pavan Kumar

Greenhorn
+ Follow
since May 31, 2005
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 Pulamathi Pavan Kumar

Hi,

It is mentioned in JLS that in Floating point numbers -0.0 and +0.0 are considered equal when "==" operator is used. Hence true is the answer.
If any thing is to be changed in the answer for perfection, please let me know.

Regards,
Pavan.
In Java only operator overloaded is " + ".

U cannot append character with a string since + is used only with Strings.
in the second line s+=c,

Everything that gets appended to String will be converted to String.So it works in the second case.
For ur clarification,

int i=2,j=4;
String str="abc";
System.out.println(str+i+j);
System.out.println(i+j+str);

Outputs will be:
(1) abc 2 4-----> If anything appended after a string, entire is a string.
(2) 6 abc

Hope this shuld help...

pavan.
Hi Smitha,

In the 2nd method u are using the Wrapper class reference as an argument.
In the main u are invoking the method with a primitive type which is within range of integer. So, 1st method is invoked and hence the answer.

Pavan.
Hi Smitha,

The concept u need to understand is:

"When a method is invoked on an object using a reference, it is the
CLASS OF THE CURRENT OBJECT denoted by the reference but not the type of the reference, that determines which method implementation will be executed."

Hope this should suffice u.

Pavan.
I think, Only 2 Objects are created. To my knowledge, objects are created using the "new" operator. But String s2 is a reference. Hence forth only 2 objects are created.

Let me know if this is not a valid reason with explanation.

Regards,
Pavan.
Hi Johan,

Thanx for ur suggestions. I am looking for stuff from various sites including the Mock Exam Papers.

Presently going through Java Language Specification 3.0.

Keep suggesting the things and be in touch...Once again Thanx .....

Pavan.
17 years ago