mmkris_1

Greenhorn
+ Follow
since Jun 18, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by mmkris_1

Hi
I have visited that link and found that instead of 310 025 the number is 310 027. What is the difference between them and also will i be allowed to take 310 025 or it will be withdrawn. If it is withdrawn, when?
Thanks
murali krishna
Hai
I have heard that SCJP syllabus is going to change from
october 1st. Is this true? Please some one help me. I am taking the test in the first week of october. If it is changing i will take it in this week.
Thanks
!!Also where can i find that the test syllabus is changing
!!if possible link please!
When u changed u made the method to be static. So it can be called directly without an instance of the outer object. In fact this can be done directly by declaring the inner class itself static. So the answer is basically true not false.
hi everyone
I think a class needs to declared abstract if it has one or more abstract methods. The viceversa need not be true i.e. if a class is abstract then it should contain only abstract methods.
hi
Thanks very much. I forgot to look at the initialization of the
object private. I kept thinking that there are no variables to initialize. I know that all variables are initialized before the constructor is called.
Thanks Jason
murali
hi
there is no j
Actually it is y. I made a typing error.
output of y is 5.
thanks Nirmal
murali
can anyone help us how the program works for both
continue label1 and continue label2

Originally posted by Nirmal:
Hi Gouru,
I run this program and got the answer as '5'. I put messages in and saw the output.
When the value of 'i=5',it will come out of loop and the control goes to 'label1'. In lebel ,the loop value becomes false and so it come out the loop without decrementing value of y. So y is still the same (ie 5). When you print intermediate results in the program ,you will better understand the flow. Hope this clears some basics of your question. Any changes or modifications?.
Thanks.
Nirmal


Hi gouru
I have run this program and found that this runs for all the three cases i.e.
continue label1;
continue label2;
continue;
Actually, It is not coming out of the loop when 'i' reached a value of 5 to label1 as stated by the Nirmal.
When we are saying continue label1 or continue label2 or continue
the control is transferred to the beginning of the loop. Also the other label1 is treated as entirely unknown. Only after i has reached a value of 10 it is coming out of the initial for loop. Then it is executing the other statement.
label1:
for(;i<5;i--)
{
y--;
}
The value of i is 10 hence it is coming out of that for loop without changing the j value.
The output of j is 5.
So label is not exactly like goto. Label has restrictions and can be used only for the same loop and cannot be used to transfer control out of the loop.Compiler gives an error when you try to pass control to outside the loop. Here two label1's are treated as totally different. One thing i could not understand is the fact that this loop is working for both continue label1 and continue label2. This is really surprising.
Anyone can help us
murali
It is possible to have multiple level of nesting of
classes. It is legal
!!! if wrong correct me
Hi Vivek
I think here in the if statement the references are compared.
As they both are not pointing to the same object you will get false.I think this has cleared.
murali
Hi
Can someone please help me in understanding the output of this
program.
class Egg2
{
protected class Yolk
{
public Yolk()
{
System.out.println("Egg2.Yolk()");
}
public void f()
{
System.out.println("Egg2.Yolk.f()");
}
}
private Yolk y= new Yolk();
public Egg2()
{
System.out.println("New Egg2()");
}
public void insertYolk(Yolk yy)
{
y=yy;
}
public void g()
{
y.f();
}
}
public class BigEgg2 extends Egg2
{
public class Yolk extends Egg2.Yolk
{
public Yolk()
{
System.out.println("BigEgg2.Yolk()");
}
public void f()
{
System.out.println("BigEgg2.Yolk.f()");
}
}
public BigEgg2()
{
insertYolk(new Yolk());
}
public static void main (String args[])
{
Egg2 e2 = new BigEgg2();
e2.g();
}
}
I was actually expecting output as follows
New Egg2()
Egg2.Yolk()
BigEgg2.Yolk()
BigEgg2.Yolk.f()
But the output is
Egg2.Yolk()
New Egg2()
Egg2.Yolk()
BigEgg2.Yolk()
BigEgg2.Yolk.f()
Hi udayan
As long as direct access is considered one cannot access non static members without an instance. I have mentioned that it is possible to do it in this way.
murali
hi nikita
I think this is a case of forward referencing.
So here compiler doesn't know that get is existing. So it cannot initialize. But still it is showing 0 because all the object members are initialized to binary zero when an object is created.
Hence you are getting 0.
murali
Hi every one.
There is a way for accessing nonstatic methods and data by using class names. This is done by calling static method which returns the object reference. This object reference is used to open the nonstatic members. So it is possible to use class name to access the nonstatic data.
!Please correct me if i am wrong.
murali