Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Rahul Kumar

Greenhorn
+ Follow
since Aug 01, 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 Rahul Kumar

well, i am reading Head Firstin java too and banging my head ...
but still missing out lot of things..
Hi friends,

I hav just started preparing for SCJP 5.0(tiger) with the aim of conquering the tiger.. but even after 15 days i still struggle to find out some of the basic things about java..(i hav previously working experience of 6 months in java)
i need a book where i could get the flow.. and can make every point clear..

Ex. when is the finalize method call.. with some examples..

Now the problem is if i will go deep into this i may loose my focus from
SCJP 5.0 So i need guidance of how to finally conquer the tiger. and mastering the Java language...???
Hi all,,


I want to know the execution sequence..

Whethere the sequence i hav written is correct or not..
1) First static variables
2) Static block
3) Main method
4) Non Static variables..

If anybody has any good link kindly share it...


hi SEEMA

How this SCJP kit is different... I need the contents of this kit..
and one more thing..
like based on what facts the topics and mock tests are include in the kit..


Thanks and regards
hi Andy,

One more thing i got..
I called the variable x using Class

public class staticTest {

static{
x=8;

System.out.println("value of is :" + staticTest.x);
}
static int x=5;

public static void main(String[] args) {
System.out.println("value of is :" + x);

}

}

Now no errors... I am not clear what is happening .???
Now after putting the SOP in the static block i am getting the compile time error..

public class staticTest {

static{
x=8;
System.out.println("inside static :"+x);
}
static int x=5;
public static void main(String[] args) {
System.out.println("value of is :" + x);

}

}

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at staticTest.main(staticTest.java:9)
well if both static variables and static block is present which is run first...

Well Mr. Owen if it is in the order they come in the java source program why the compiler doesnot gives an error for this.

public class A{

static{
x=5;
}
static int x=9;
}
hi,

I agree with Andy.. i checked the code and run it ..it has not given
any error..

public class A{
static{
x=6;
}
static int x=4;

PSVM(){
SOP(x);
}
}

But the output is 4 not 6.
hi Naseem n all,

Well now i am pretty much clear with this..
but still

public class A{
static int x=1;
static {
int x=9;
}
p.s.v.m()
{
sop(x);

}

is same as

public class A{
static {
int x=9;
}

static int x=1;

p.s.v.m()
{
sop(x);

}

Is there any difference in between the two..??

Well Mr. Naseem FYI my last name is not HA HA... hope
it doesnt matter to you too..???
hi guys...

I am again confused... Can anybody tell me what actually happens when we declare the static block.. how the flow goes ???
and if we have both static block and static methos what actually happens which is called first???
Hi Seema,

Welcome,

Well i want to clarify one doubt..?

Does the SCJP 5.0 exam covers really all the core java concepts ..???
and after atttainig do we be really using the concepts learnt during the preparation.. i am working on a live project in java.. and the guys just to make the code run .. write codes in all the possible ways..

Kindly address this.



[HENRY: slight change to subject header]
[ August 08, 2006: Message edited by: Henry Wong ]
hi Nidhi,


Cant get....
hi ,

What wud be the output , kindly provide me the explanation too....?

class A{
static{
int x=8;
}
static int x=5;
public static void main(String a[]){
System.out.println(x);
}
}
Hi ,
Can anybody explain me here in the code the implication of autoboxing...

public class Ex {

Integer i;
int j;

public void go(){
//i=j;
j=i;
System.out.println("value of j :"+ j);
System.out.println("value of i :"+ i);
}

public static void main(String[] args) {
Ex obj=new StaticEx();
obj.go();

}

}

Regards,
Amazer