Indraneel Das

Greenhorn
+ Follow
since Oct 15, 2002
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 Indraneel Das

Thx Arpana for clarifying my doubt. Now its clear to me.
Regards
Indraneel
Hi all
i came accross the following question in one of the mock tests of Dan Chisholm:

class test{
public static void main(String args[]) {
String a = "A";
String b = "B";
final String c = a+b;
final String d = a+b;
System.out.print((c==c) + ",");
System.out.print(((a+b)==(a+b)) + ",");
System.out.print(c==d);
}
}
Prints: true,false,false
Now if both the variables a & b are declared as final, then why the output changes to
true,true,true

Thanx and Regards
Indraneel
Thanks Alfred and Ravish for the information ... they are really very helpful to me and cleared my doubt ... but i have to study more to have confidence ...
Thanks to all
No problem, I have changed my displayed name.
thanks
Hi all,
Please explain results of the follwing 2 ques ...

The programs throws a java.lang.ClassCastException at the line labeled (3) when run.
Why the exception comes even if an explicit cast (B[]) is made at line labeled (3) ??
Here is another program on polymorphism :

The program will print 2 when run.
Please explain why so ?? why not 1 when explicit cast of (B) has been provided ??
Thanks in advance,
Indraneel