Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

singh amit

+ Follow
since Jun 26, 2006
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 singh amit

I would like to thank all the ranchers, esp dis forum for this excellent forum cum Knowledge Repository which helped me a lot for my exams.

I would also like to thank Kathy and Bert for their excellent work in the form of SCJP 5.0 Exam Study guide... Belive me if you read this book and solve all its Q then you can be assured of atleast 80%. Hail ... i have already bought the their book "Head First Servlets and JSP " gearing up for SCWCD :-))

Gave only 2 -3 Mock due to unavailability of time(9 days is what i had to study the book and give the test :-))) But they are a worth spent of time...esp JQ++ ...

Thanks once again.

Amit S
15 years ago
Thanx a lot.

I missed out the panecea of Polymorphism
If wait and notify methods are not enclosed in Synchronized blocks then will they always thro exception at runtime
1) True
2) False

Is the answer false ?
Cos only of the calling code does not have lock on the object on which wait is called then only IllegalMonitorState Exception. Is this correct
public class B
public static void main(String args[ ] )
String str = "true";
String str1 = new String("true");
StringBuffer sb = new StringBuffer("true");
Object obj_string = new String("true");
Object obj_boolean = new Boolean("true");
Object obj_sb = new StringBuffer("true");
Object obj = obj_sb.toString();
System.out.println("str=" + str+ " str1 =" + str1 + " str.equals(str1)=" +str.equals(str1));
System.out.println("str=" + str+ " sb =" + sb + " str.equals(sb)=" +str.equals(sb));
System.out.println("obj_string=" + obj_string+ " obj_sb =" + obj_sb + " obj_string.equals(obj_sb)=" +obj_string.equals(obj_sb));
System.out.println("obj_string=" + obj_string+ " obj =" + obj + " obj_string.equals(obj)=" +obj_string.equals(obj));


1) str=true str1 =true str.equals(str1)=true
2) str=true sb =true str.equals(sb)=false
3) obj_string=true obj_sb =true obj_string.equals(obj_sb)=false
4) obj_string=true obj =true obj_string.equals(obj)=true

Some one please explain the following points
1) Why in 3) and 4) in output "obj_string.equals(obj_sb)=false" BUT obj_string.equals(obj)=true

2) Why in 2) in o/p "str.equals(sb)=false"

3) When does a new String is created (and not picked up from the String Literal pool) so that == comparision will return false.

4) Is there any relation between String Pool and .equals. in String

5) String had .equals(object) and .equals(String)
So if you have something like
Object a = new String ("amit");
Object b = new String ("amit");

How are Strings or to say Objects compared here. ..... Please need some guidance in this topic. Getting many Questions wrong in the Practice Test concerning String Pools

It was really nice to get some Question on SCJP 5.0
But there are some problems.
1) Drag and drop Questions
a) Difficult to read
b) Marked answer are lost (even if they are not revisited)
c) Some Answers are incorrect

2) General Q.
Answers to some Q are incorrect
Wordings of even some questions are incorrect.

People giving the test please verify the Q and A. If in doubt...