Help coderanch get a
new server
by contributing to the fundraiser

chennur gudur

+ Follow
since Dec 29, 2005
Merit badge: grant badges
For More
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 chennur gudur

I think the answer is F
please check this code
class Test45
public static void main(String[] args)
String s1 = new String("ABC"), s2 = new String("ABC");
StringBuffer sb1 = new StringBuffer("ramesh");
StringBuffer sb2 = new StringBuffer("malli");
System.out.print(s1.equals(s2) + "," + sb1.equals(sb2) +","+ (sb1==sb2));

What's the answer for this . I think true,false,false.

My doubt is can't we ever compare StringBuffers How can we say two String Bufferes are equal,explain .
Harshil Mehta is right because since while(true) always executes so assert Error will be thorwn definitely so control can not reach line 20.
Hi i am also appearing for SCJP can u please send the notes of sasikanth malladi and my mail id is am asking sasikanth malladi also , can u please provide some help to clear SCJP.

18 years ago
Hi poonam , i think A and C are correct correct because here u have to consider both overriding and overloading.In overriding signature and return type must be same and access modifier is same or less restrictive compare to parent classs and Exceptions must be narrower than parent and In case of overloading the arguments must differ so if u consider these two things , only A and C are correct . B is wrong because it is overriding and used private. D is wrong because it is overloading but only return type changed so comple error .E uses static modifier.

for u r second question , ans is private . When a protected member function gets inherited to subclass private specifier is assigned to it by default