Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Rachana Sharma

Greenhorn
+ Follow
since Jun 21, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rachana Sharma

hi,

As i mentioned i took marcus green's all the four exams, K&B master exam,
then Khalid Moghul's exam,
and Dan chislom's single topic exams were really a good way of leraning the concepts.

The exams listed in the mock exam list in this site are also very good.

All of them gave me lot of confidence and good way of learning.
And what people say here is absolutley correct one should give lots of mock exams before attempting the real exam.

bye,
rachana.
17 years ago
Hi,

I passed SCJP on aug 6 with 85%,

i've been visting this site regularly and would like to thank you all for
those questions with the aid of which i really started appreciating and got inspired to take up this certification.

My primary resource has been K&B thanks for the wonderful book to you both.

Marcus green 's tests and other mock exams listed in ranch site were very useful.

Thanks everyone,
Rachana.
17 years ago
Thanks for the answer.

Just go through the code and my doubt is why does the compiler show error when we don't extend the outer class and just want to extend the outer.inner in the TestInner.

hello everyone,

could anyone please tell me how is an abstract inner class implemented by other classes.
some sort of code snippet would be really helpful as iam very confused.

Thanks in advance.
hello everyone,
This is one of the questions in danchisholm's paper.

class JSC201 {
static byte m1() {
final char c1 = '\u0001';
return c1; // 1
}
static byte m2(final char c2) {return c2;} // 2
public static void main(String[] args) {
char c3 = '\u0003';
System.out.print(""+m1()+m2(c3)); // 3
}}

What is the result of attempting to compile and run the program?

a. Prints: 13
b. Prints: 4
c. Compile-time error at 1
d. Compile-time error at 2
e. Run-time error
f. None of the above

The answer to the above question is option (d).There is a detailed explaination given about the answer but iam not able to follow it.
could someone please explain the output.

Thanks in advance.
hi,
when we invoke the derived class constructor first it calls the base class constructor as we all know,
but trying to call the method add() from the base class constructor will invoke the derived class add() method since it is overriding the behaviour of its base, had there not been any add() in derived certainly it would go the base class's add() method as expected.
hope this helps.
when we overload a method and try calling it then the method call would try to match the most nearest method's parameter.
since BA is subclass of AB so it prints B.Had it not been there it would have printed A.
hi,
when we want to intialize a member variable int Scores[];we jus assign some values to it,
so that explains the options b,c but in option (a) results in creating a new array with the same name,rather than intializing the member variable(array),
we are hiding the global member variable with a local one.
so i hope this explains the reason for option(a) not being the answer here.
hi shubha,
i understand the reason for the inconsistent output is that when we call the start method on a thread is actually placed in a runnable state where it is eligible to be choosen by the scheduler for running(the actual state where the thread is alive).
so, there is no garuntee that if a thread calls its start method first it will be executed then and there, it all depends on the scheduler.
hope this helps to understand the reason for different outputs when the same code is run many times.
hi Alex first of all ur question gave me a chance to learn more about the protected access modifier.

what i could find is that,though we declare the inner class as protected when we actually extend the outer class in a differnt package in your case the "kidout extends dad" as we don't have any constructor for the nested class, so when we try to create it's object through the outer class then a default constructor comes into play.

this default constructor has the visibilty of protected as that of its class(the inner class)
ans since we dont extend the inner class directly we can't inherit the constructor.

so, the solution to the problem is just create a constructor with public visiblity in the inner class.
hope this helps....... as iam just a beginner.
thanks for the answer it seems to be clear for me now.
thanks for the explanation but how do you explain this output
class Base{
public Base() {
System.out.println("base default constructor");
}
public Base(int i) {
System.out.println("base constructor:"+i);
}
}

class Derived extends Base{
Derived()
{
this((int)9);
System.out.println("derived default constructor");
}
Derived(int j)
{
super(j);
System.out.println("derived constructor"+j);
}

}

public class test
{
public static void main(String args[])
{
Derived obj=new Derived();
}
}
output:
base constructor:9
derived constructor9
derived default constructor
shouldn't the base class default constructor be called here again in the default derived class constructor??
then ideally the oupt should have been :
base default constructor
base constructor:9
derived constructor9
dervived default constructor

output:
base default constructor
derived constructor:9
derived default constructor
could someone explain the output in terms of this() used in the code?


(made not so loud)
[ June 21, 2005: Message edited by: Barry Gaunt ]