Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Garg Sharad

+ Follow
since Jun 20, 2009
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 Garg Sharad

The answer would be 10.
11 years ago
The Output of below statement is correct because
((AClass)b).m(); // Does compile and return B\nSuper:\nA

There are two things happening

one is compile time polymorphism.
It's happening because you are doing BClass object type cast with AClass object so this thing checked at compile time.

second run time polymorphism.
At run time even you are using sub class object with super class reference it'll call sub class object method.

You are getting compile time error at

b.m(); // Does not compile

line because method m access modifier is protected and you can not use out of protected member out side the package without using inheritence.


Is there any body having idea how can i set maximum size for server log in jboss because my server log size is increasing frequently so i am unable to open it.

Please let me know if anybody is having idea about it.
Hi All,

I cleared SCJP 6 with 95% marks.

Thanks all rancher's.

12 years ago
Thanks for your clarification


Output of this prograe is nullpointer exception

Can anybody tell me why it is showing nullpointer exception.

While Code

is producing output: 1

Please tell me if any body is having idea abt it....

-Sharad Garg
static - any code block or instance constructor or method can set this so long as it has access
final - must be initialised at declaration, in a code block or in an constructor. Once initialised, it cannot be changed.
final int i;
public Test() {
static final - must be initialised at declaration, or in a static code block. Once initialised, it cannot be changed (and that includes instance constructors).

static final int i;
i = 10;

sumit Bhatnagar wrote:Hi,
I have cleared SCJP examination with 97% marks.

Congra8s Sumit

12 years ago
Please give me solution of this Exception
java.sql.SQLException: Parameter index out of bounds. 6 is not between valid values of 1 and 5

Hi Adrian Bucur,

Could you please tell me how many drag and drop question was there, Because i am also planing to give SCJP 6 exam in next month.

Thanks in advance.

12 years ago
In this case only one object (t1) will be able to GC because t.b1 and t1.b2 are only the reference variable so they will not available for GC.

Madhu Desai wrote:Thanks Mason Storm

I think this is correct representation...

Still...where exactly will class's static variable be? - Stack or Heap?

object of a class always created in HEAP.
Can you please share me the code of Class X.