Praveen Ponna

+ Follow
since Nov 26, 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 Praveen Ponna

Today I cleared the SCJP 1.4 exam with 75%.

Although I was not actively participating in this forum, I was following all the topics closely and it helped me a lot.

I feel K&B is a excellent book and it helped me a lot. I wish i would have read this book second time befor taking the exam!!

Thanks a lot to every one!!!
18 years ago
As per the java doc "java.lang.InterruptedException" is defined as:

Thrown when a thread is waiting, sleeping, or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread.

When I was checking for its usage I found it in join() and sleep() method of thread class and wait() method of Object class.

Why not Yield() method of thread?

Is this in scope for SCJP(1.4/1.5)?

I don't think there will be 3 "hello" strings created in the given scenario.

Refer the link provide by Jorg Klein above!


I came across an intersting question in one of the mock exams. Can any one explain the reason for change in behavior when we change the access modifier at //A to public?


Consider these classes defined in separate source files and in the same package. What will happen when you try to compile and run the class Person?


If executed as given in the example:

If the access modifier is changed to public at //A


Are you sure the given code snippet is compiling?
It must throw a compile-time error at line 3 and 4.

Check your answer again.

I came across this question in one of the mock exams, but I feel the answer must change for the newer version of SCJP (JDK 1.4 and newer).

and the answer is given as


But as of JDK 1.4 stop() is deprecated method.
So given the above question should the answer be acd ?

[ February 11, 2006: Message edited by: PraveenPonna ]

Which author are you referring to? And where did you get this example from?

The answer is correct! when you use 'this' referance as in line //2, then the variable is visible but not in line //1 as it throws a illegal forward reference exception.

Can any one throw more light on this exception?


[ February 09, 2006: Message edited by: PraveenPonna ]
[ February 09, 2006: Message edited by: PraveenPonna ]
As you know the output of your program will be

because, in case of conflicting variable names the method m1 will prefers the local variable.

If you want to access the variable i1 defined at (1) then you have to provide the class name as the qualifier.

I guess there are 2 things that seems to be confusing in this post:

1: Raghu's example: If you check back his first reply, it refers to

and not the original value 'x=5' .

2. Although actual answer given by Raghu is correct. When you declare a variable as final and assign it to another variable, then its as good as assigning the literal value itself.


this is same as:

But if you remove final from the declaration:

then the compilation fails, as 'x' can take up any value (>127)

Hope this clarifies everything!!
[ February 02, 2006: Message edited by: PraveenPonna ]
Yes, both a and c are true!

A better version of hashCode is:

public int hashCode()
return (s1+s2+s3).hashCode();