Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!

Murali Kakarla

Ranch Hand
+ Follow
since Jul 11, 2007
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 Murali Kakarla

Yes I also face this dilemma whenever I read this statement. Can some one please explain?


Now, my question is: What happens to the "Hello" created in the pool?
Is the same one used for the other string references too? (s1 and s2)??
I don't think so, wanted to confirm.
I think there are 2 string objects in the pool and 1 in the heap.

Whenever a string literal is used, it first checks if same string literal exists in the pool. If it exists then reference of it is assigned or else it creates a new string, puts it in pool and then assigns the reference.

In this case at lines 2 and 3, s1 and s2 refer to same Hello object which was created in a pool at line 1.

Hence only 2 objects are created in this scenario.

This seems to be a very good question.
Can some one explain this? Is it valid to have a java variable name starting with a 'pound' char/symbol? If so how to code it?

14 years ago

All exceptions that are subclasses of RuntimeException are UNCHECKED, which means they are not being checked by the compiler whether you have followed the handle-or-declare rule.

All exceptions that are subclass of Exception but not of RuntimeException are checked exceptions (meaning, they are being checked by the compiler whether you have followed the handle-or-declare rule.)

To add to what said by Jart,

Error and it's sub-classes are also not checked by compiler.

Throwable and its sub-classes are checked by compiler

Hi Anuj, yes we can implement both the interfaces.
Here is the sample code which got compiled successfully:

SCBCD5 Aspirant
Hi Mallika

Can you please give me the link where I can take Sun's free assessment test? I am planning for SCBCD in a month.

SCJP5 (90%)
Hi Subha
As I said K&B book is enough. I have actually given more importance on Generics. But it is not necessary. Whatever covered in K&B book is more than sufficient when Generics is concerned.
I think one needs to give more importance API and should be well versed with writing small programmes using API as there would be around 10 drag and drop questions asking you to complete the code.
When it comes to collection classes/interfaces one should know basic purpose, behaviour (like its performance w.r.t various operations) also.

I found Whizlabs mock tests also very helpful. By going through those mock tests one can know what kind of tricky questions can be expected. And as every rancher says you will score 5 to 10% more in actual exam than the score you get in whizlabs mock tests.

Hope this would be helpful to you.

15 years ago
Thanks a lot to all ranchers. This forum helped me a lot in passing the exam with good score. Also K&B book. We need only these two for SCJP.

SCJP 5 (90%)
15 years ago
Page 236 of K&B book have the explanation for this.
Here is part of it for your reference:

two instances of the
following wrapper objects will always be == when their primitive values are the same:
* Boolean
* Byte
* Character from \u0000 to \u007f (7f is 127 in decimal)
* Short and Integer from -128 to 127

Hi Gaurav

Integer as = 303;
long lo=303l;
System.out.println(as==lo); // Line 1

The compiler will throw error in line 1 as compiler cannot unbox Integer and Type case it to Long at the same time.

Have you tried to compile the above code? There is no issue with the above code and it compiles without any errors and prints o/p: true

In Page 490 of Bert and Kathy book:

"," Use locale-specific grouping separators....

In Page 489:

The format() and printf() methods were added to in Java 5. These two methods behave exactly the same way, .....

I think this clears your questions.

In Page 489 of SCJP book by Bert and Kathy:

printf("format string", argument(s));

The format string can contain both normal string literal information that isn't asscoaited with any arguments, ...

Now I want to print char % using this printf method. Is this possible?
I have tried System.out.printf("%1$d %", 25); and System.out.printf("%1$d \\%", 25);
It is giving "Exception e: Conversion = '%'"

Is it that we cannot print this special char % using printf/format methods?

[ February 07, 2008: Message edited by: Murali Kakarla ]
Thanks Mani. It worked

I really did
I think this is good experience to me before taking exam