Nandish KB

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

Recent posts by Nandish KB

Hi all,
somedays back while searching for FREE SCJP exam, I found one webpage.There are a lot of free exams and in the home page it will list the members who have scored highest with ranking. There are a lot of members and free scjp exams.
Anyone if u know that url plzzzzzzzzzzz tell me. I forgot to bookmark that page.

Ofcourse NOT this one, http://www.javacertificate.com
Hi Prashant,
Thanx for ur response.Yeah I came to know about it by drawing diagrams as per ur suggestions..

Thanx.
Hi PETER,
1. Unless u override the equals() method, it will just compares the object references. here in SOP(System.out.println) the Object class' equals() method is called. As u r creating new 2 references, it will compare the BITS(internal representation , nothing but address(long integer)). So they are differnt.It will result in false.

2. When u call String s1 = "amit"; it will internally calls like this,
String s1= new String("amit");
JVM's String handling is like that, while creating Strings, for OPTIMIZATION, it will point the 2 references to the same object whose contents are same.But in S2==S3 case, this is somewhat different, as you are calling replace()method, The String.replace method will create a new object, As I think at this stage it wont look for optimization.

Correct me If I am Wrong,
Regards,
Nandish
4 Which line of code inserted //Here will free up a single object for garbage

collection?


Answers:
1 a.i = null;
2 b.i = a.i;
3 b = null;
4 a = d.i;
5 d.i = b.i;
6 e = null;

Correct Ans: 5

Plz Explain me in detail Y 5 is the correct ans.
Regards,
Nandish
[ September 22, 2004: Message edited by: Barry Gaunt ]
Ohhhhhhhhhh sorrrrrrrry,
I actually written those codes in main() method.
Sorry to post wrong Qn ! :-(
Regards,
Nandish
Hey I checked the same code with Eclipse.Its giving compiler error.
Even I tried with

int a=b=3;
static int b; // this also gives me error, I think it should work rt ?. as forward referncing for static vars is allowed


int a = b = 4;
int b; // here also its giving errr

plz clarify my doubt

Thanx
Nandish