Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Vijay pillai

Ranch Hand
+ Follow
since Jan 10, 2001
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 Vijay pillai

hello all,
can some one please tell how is the job opportunity for a certified fresher.
also can someone pls tell me which companies entertain freshers.
as I am really keen to get started.
I cleared certification with quite a decent score and now aspire to get started as a java programmer in Mumbai.
can some on help me with some tips.
thanks in advance
Vijay Pillai
21 years ago

hi friends,
I am finally a java certified programmer,this is what I had dreamt to call myself.
cleared it today,though not with a very high score..
I guess 79% is not somethingh to brag about,but I accept it fully with my heart and soul.
I found the actual exam tougher than the mocks I have attempted,
I was consantly scoring well in JQplus,with a score of b/w 80 and 85% in the last 3 tests and above 75 in the rest of them.
I had couple of codes on threads followed by multiple choices.
altogether 6 on threads.
I lost a lot of points in AWT as it was always my weak area,
Util ditched me as I couldnt figure out what was the question pointing at.
I had a fill in the blanks question which I feel I got wrong.
I presented it in quotes as it was a String.I thought quotes should be the actual way to present it..But I guess I lost marks there.
well overall I guess its not a bad score for a first timer,but I would have liked a 80+ atleast.
finally a bit of advice if I can?
All I would like to tell all u JCP aspirants is that it is very important to keep cool and be alert during the exam,as they really test u.
I would like to personally thank all of u'll for this beautyfull forum.This is what really helped me.
And now I guess its party time.
bye and all the best to all the exam takers,
Vijay Pillai
21 years ago
hi shah,
Let me give it a try,
By saying new SomeClass().method(),an object is created in the heap memory just like SomeClass s=new SomeClass(),the only diff is that the object created by saying new SomeClass() cannot be referenced later in the program,which also means that the obj created is eligible for garbage collection just after that line ends.
but as far as the memory space is concerned the space occupied has nothing to do with the way the objects are created.
note that String s="vijay";
this places an Object in the stack not in the heap.
but with regards to certification we dont have to know that.
Vijay Pillai
hi shah,
the ans is actually two obj created,You should remember that B is just a reference and it is pointing to the same oject that A is pointing to.
hence one object which is referenced by B ans A,
the second object is the new String returned to C.
hope this helps.
Vijay Pillai
hi Ashish,Shrini
good luck to both of u'll
Vijay Pillai
hi there,
I think the Object referenced by arg1,Is elligible for GC after the scope of the method.
the code:
public class MailDemo
{ public static void main(String args[])
{
String msg="Hello";
String arg1=new String("VoiceMail");
msg=msg+arg1;
String call="Calling this program";
System.out.println(msg);
//System.out.println(arg1);
}
}
In this case msg is being assigned a concatinated value of Hello and VoiceMail.In this case Hello is elligible for GC after line 7.But arg1 is still pointing to the same Object hence is alive till the scope of this method.
In that case how can line 7 be correct.
Does all the GC gurus agree to me.
If not pls reply,I would really appeciate any form of help.
Vijay Pillai
hi again,
can someone expain this.
we can make the Garbage collector run with a call to System.gc,Irrespective to whether the Object will actually be Garbage collected or not.
true or false.
if true then how can the answer to the previous Q be 1.
and if false,I need some help in this topic.
May be someone with a better understanding of GC could explain.
Vijay Pillai

hello friends,
I found this Q in Marcus Green(exam 1)
You are concerned that your program may attempt to use more memory than is available. To avoid this situation you want to ensure that the Java Virtual Machine will run its garbage collection just before you start a complex routine. What can you do to be certain that garbage collection will run when you want .
1) You cannot be certain when garbage collection will run
2) Use the Runtime.gc() method to force garbage collection
3) Ensure that all the variables you require to be garbage collected are set to null
4) Use the System.gc() method to force garbage collection
I am slightly confused about the answer,the ans is 1.
What I feel is that a call to System.gc() or Runtime.gc(),will definetly run the Garbage collector ,But we cannot be sure whether the Object will actully be Garbage collected.
but the point is we can run gc when we opt to.
In that case,ans one cannot be correct all we can do in such a scenario is remove all the references to the Object and ensure that that particular Object is no longer referenced,and call either of the two methods and pray.
but how can ans one be taken as a right one,pls help me.
Or am I not getting it right
Vijay Pillai

Thanks Vikas,
U fully deserved it,Thats a very good score..
congratulations.
Vijay Pillai
21 years ago

Thanks Vikas,
U fully deserved it,Thats a very good score..
congratulations.
Vijay Pillai
ashish,
Sorry i was pointing on to the wrong person.
hi prakash,
Thanks for the advice I think JLS will be a good place to clear this out.
Thanks
Vijay Pillai
my emailid is pillai_vij@rediffmail.com
hi guys,

seems to be a lot of guys inn for the month of Feb,
I would like to join the gang,I am appearing on the 26th this month..
I wish u all lots of good luck...Wish me too.
to bigin with pls clear this doubt of mine.
why is this code behaving thisway,
this comes from velmurugans notes.
int array[] = new int[5];
int index = 0;
array[index] = index = 3; // 1st element get assigned to 3, not
//the 4th element

for (int c = 0; c < array.length; c++){
System.out.println(array[c]);
System.out.println("index is " + index); // prints 3
}
the assignment as far as "=" goes is from RHS to LHS,
if thats the case the vale of index becomes 3,which is actually happening,but why is it that the array[index] still hold on to "zero" and does not itself become array[3].
hope i make myself clear.
guys,pls come forward
Vijay Pillai
hi,
One reason I can point out is only because Strings are immutable using StringBuffer is a better programming practise,specially if we are dealing with manipulation of String.
Use of using String is not recommended in this case because, almost all the methods in String class when called on an object returns us a new String object(Remember String object cannot be changed).This is an unnecessary act which if avoided is considered as a good practise in some scenarios.
But when using StringBuffer,we can manipulate the same String object and when we r done call the toString() which converts the String in the Buffer to a String Object.
Hope this helps
Vijay Pillai
hello Jane,
Thanks for the response from u,U r really trying to help and i very well appreciate that.
now about the explanation u gave in the previous one addressed to me.
I din't quite get what u were pointing at,as that code still behaves the way in which we started the discussion from,or am i getting it wrong.
pls correct me here.following is the code u posted I have made certain changes to it so that u can understand what I am pointing at.

class TestWhileWithFinalConstant
{
final static boolean expr =true;
// instance initializer block
{
//check this
while(expr )//--this if changed to true instead of expr
//will not compile.
{
int i = 0;
//a break with out a runtime condition placed here will
//make the statement followed unreachable,but then that has
//nothing to do with final constants.
System.out.println("In instance initializer");
i++;

}
System.out.println("this will not reach if the while(true), but reaches with while(expr)");
}
// method block
public void method()
{
// this loop does not produce a compile error
// even though it is an infinite loop
while( expr )//assuming expr is false ,when this is
//changed to "false"
//changed to "false"
//instead of expr will produce a compile time error .
{
System.out.println("In while loop");
}
}
public static void main(String str[])
{
new TestWhileWithFinalConstant();
}
}