nishesh chouhan

Ranch Hand
+ Follow
since Nov 06, 2000
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nishesh chouhan

I dont know why did u thought that I am a ranch hander
no dear I am green horn now can u expect such ques from me
:-) well right now I am doing my engg from REC (bhopal)
I am III yr with cse as my stream ...
the boones exam does not have answer with it
ps can anyone tell me where can I find its answer
but what does stop here means wait and sleep does not stop the thread they only stop their execution temporarily
so inwhat context the question is asked
and if that is the case then yield also stops temporarily
I am in urgent need for some good tutorial on thread(which throws much light on monitors , locking synchronization , wait ..) and AWT
possibly with some good working example
Q) see the following code
public class A
public stratic void main(String str[])
class B extends A // (1)
// some code
if at (1) I put private the compiler says that package members should
be accessible to the package members
and if I put protected then it says that class or interface declaration
but I think that they should be allowed as they are applied to class which does not contain main method what is the problem with that
anyone ps explain me that ..
I have doubts in following questions
1)which of the followuing can be added to the menu

does it had something to do with the inheritance hirarchy??? so that we can know by that
2) which of the following will definitely stop the thread from execuiting
which bvariable can an inner class access from the class which encapsulates it
1 all static variables
2 all finla variables
3 all insrtance variable
4 all instance final variable
5 only finla static variable a

what does the inner class means here static or non static also ther can
be many possibilities it can be within a static outer class or non static outer class
what shuld be assumed in such Questions
# hashcode
if the reference x and y denote two different objects
then the expression x.hashcode ()== y.hashcode() is always fasle
the above quote is from khalid mughal page 299 Q 10.2
I think that it is right b'coz hashcode returns unique for every object
but according to author it is not always right can anyone ps expalin
me why is this so
still I am not very clear with it ps tell me where do we use this and for what purpose
thanks cindy for your reply .I got it ......
could any one tell me that can an interface implement the abstract class .
could anyone tell me what all options are right among the following
1) we can call finalize method expicitly ( i think yes in case of overided method)
2) finalize must be declared with protected accessibility ( but if we override it then we can change the accessibility ??)
3) if an object is collected by GC its finalize method is guranted to be called
when we call stop method of applet then does the objects get gc
or not
StringBuffer s2=new StringBuffer ("hello"); //1
String s3 =s2.toString(); //2
System.out.println(s3.equals(s2)); //3

1) the output at 3 is "false" but it shud be true
2) if at 3 "equals" is replaced by "==" then it gives error . why??
StringBuffer s1=new StringBuffer(�ab�);
StringBuffer s2=new StringBuffer(�ab�);

why the o.p is false ??
what does the equlas() method in
Strringbuffer class do
1)Which of the following are true about garbage collection?

a] we can set the object references to null to ensure that garbage collection will run perfectly
b] Local variables are candidate for garbage collection when the method returns (finished).
c] To use finalize() you must use a try-catch block or rethrow the error object.
d] The JVM will never run out of memory
e] Garbage collection mechanism cannot be forced

ans is ace but e garbage colection can be forced by calling System.gc()
10) 8.When is the object referenced s1 is available for garbage collection?

1.class gc{
2.public static void main(String args[]){
3.String s1="hello";
4.String s2=s1;
ans given is b but jane said that GC is for only heap variable is that
when objecct is created using new ( am i right??)
now if that is right then none shud be the answer but I am just confused with this
GC .here S1 and S2 are in literal pool so gc does not occur
but when method exits then gc takes place or not ps explain me all that
10.Which of the following are true?
a] Any class that includes a finalize method is not necessary to invoke
super class�s finalize() method
b] Java uses mark sweep garbage collection algorithm
c] It is guaranteed that only objects with no references will be garbage collected
d] you can suggest when garbage collection will happen

ans given is b, c but for me a also seems to be right

.Which of the following main method in java application is correct?

a] public static main(String args[])
b] static public void main(String []a)
c] private static void main(String args[])
d] public void static main(String args[])
e] public static void main(String)
f] static void main(String args[])

the ans given is b,c,f
but what is the problem with e ??? I think that toois right
now he ans given is c but I think a is ALSO correct
tell me if i am wrong