Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Ashley Waldrop

Greenhorn
+ Follow
since Feb 27, 2006
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 Ashley Waldrop

Static variable --> Class

Local variable ---> Starts its life inside method and is also destroyed when the method is completed. They are always stored on stack not heap.
I think you missed "}" in the end. If we have "}" in the end then this program will compile and should produce below output(Not in this format )

i=1 and j =1,2,3,4
i=2 and j =1,2,3,4
i=3 and j =1,2,3,4
i=4 and j =1,2,3,4
ISBN that you have mentioned is correct however the name of the book is

"Sun Certified Programmer for Java 5 SCJP (Exam 310-055) Exam Study Guide"
To add to
super(4) only invoke the constructer which is B(float f) from class B


B(float j)
{
super(); // Internally compiler will add a call to super() (default constructor of class A). So if there was any other constructor in A other than default constructor this would have blown.

}
[ March 01, 2006: Message edited by: Ashley Waldrop ]
You can try something like this in previous code to get a clear picture whats going on

StaticSub obj=new StaticSub();
StaticSup sup = obj;
sup.m1();
StaticSub class is only redifining method "static void m1()" not overriding although it seems like that at first look

StaticSub obj=new StaticSub();
obj.m1();

Is same as
StaticSub.m1();


so should print "from StaticSub"
Thanks Barry.

But my question is in real exam do we see these kinds of questions where more than one answer holds good without letting person know how many possible solution can be possible?

Note: In K&B normally it says "Choose all that apply" but for this only thing mentioned was to get program compile.
Question number 7 ask to fill fragments(zero or more) so that code compiles. However answer given at the end does not use "this" which is given in the fragement box.

Is it ok to omit some of the fragments for these type of questions :roll: As I had done the same question using all fragments and it compiles.

class AgedP
{
AgedP()
{
}
public AgedP(int x)
{
this();
}
}

public class Kinder extends AgedP
{
public Kinder(int x)
{
super();
}
}


TIA
[ March 01, 2006: Message edited by: Ashley Waldrop ]