Amitabh Yadav

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

Recent posts by Amitabh Yadav

Hi Kapil,
yield() is a staitc method of Thread class.When we invoke yield() method it simply returns to the ready state waiting for the scheduler to get into running state.I guess in this case when u invoke yield() method it changes the state of current thread which invoked run() method to ready state again & thus printint he next line after yield method().Well getting into running state is totally to the descretion of Scheduler we cannot determine it.
Correct me if i am wrong somewhere.

Amit
------------------
Hi Vikram ,
If u come to know more about something on this privacy statement do let me know or just put it on the forum or else mail me.
Its ok yaar for me night is when i can do everything smile no one to disturb.
Have a nice time
Amit
------------------
Hi Kapil,
Yes those methods are deprecated but if u are goign for JAVA@ certification they are Deprecated .In that case if this question comes in the exam u have to answer respectively excluding the deprecated methods.
Take care
Amit
------------------
Hi Kavita
In ur code is there any class extending to base class so that inheritance can be established???.
private methods can only be acessed by the instance of that class in which the method is written .If we subclass them we can;t acess those methods .
we can have private constructor but to make a object using that constructor u need to have a public method out there in parent class which in turns call the private contructor of the class thus makign an object.

Tell me if i am wrong .

[This message has been edited by Amitabh Yadav (edited April 13, 2001).]
Hi There,
I agree with lam here that there is no relation as such i think animal should be the superclass of every class out here & then the relationship is made quite nicely & after that we can discuss the question .ABout compilation yes its giving me problems too.
take care

------------------
Hi
I think we can set the priority of main thread using the currentThread() method.
i think the usage will be like this
Thread.currentThread().setPriority(4);
Hope that helps.
About ur second question i don;t have the lisghtest idea wat u are asking about.wat r privacy statements??

Take Care
Amit
------------------
Thanks Jane for such an extra help.I know that it shouldn't work & i guess jdk1.2.1 has some bug .Yeah i do agreed with lam .U provided some extra information thankx Jane & according ot u cameron i dunno maybe something wrong with my jdk . .thankx for ur help everybody for making me confirm the for loop contruct.
tkae care
------------------
Jonathan come o read it fully i told u i compiled & ran it on jdk1.2 & 1.3 it compliled & woorked on jdk1.2 but not on 1.3.Lam i agree with u .

------------------
According to java documentation & JLS & seeing the source file containing main method in Java language the correct signature of main method is
public static void main(String[] args){}
this is wat sun has written & this is wat u ahve to use & this is wat u have to answer if they ask the question in an exam about the currect method signature of main.

Note:- Java is open source so u can check out everything every class every method about hos it is made my Java or sun microsystem .
take care
------------------

[This message has been edited by Amitabh Yadav (edited April 07, 2001).]
Excuse me if i am wrong somewhere
the code u have written should be something like this
class abc
{
abc()
{
method();
}
void method()
{
System.out.println("method in base class");
}
}
class xyz extends abc
{
public static void main(String args[])
{
xyz ob=new xyz();
// xyz ob=new abc();

}
void method()
{
System.out.println("method in derived class");
}
}
try running the code then see the output.Also try removing the statement code in call xyz.
waiting for u reply

------------------
Yeah read the question carefull before answering it.Of course u cannot determine when will be the object will be collected by Garbage Collection but u can determine when the object is eligible for garbage collection.Yes sometimes ur program will end before any garbage collection takes place hence giving no chance to run the thread garbage collector.
For exam i will say read teh question carefully before naswering.
Good Luck
------------------
Will this work or should i say compile.
for(i=0;System.out.println("hello");i++)
{
}
I know very easy question but i am not sure about it worked on jdk1.2 & didn't work on jdk1.3.Its kinda weird anythign like that can work anywhere as normal for loop construct is
for(initialisation;condition;increment)
{}

------------------