what is the difference between yielding and sleeping? : Java thread
Answer / Wasif Husain
Yielding temporarily gives up CPU time by calling the 'yield()' method in Java. This allows other threads that are ready to execute but not yet running to run instead. Sleeping, on the other hand, suspends a thread for a specified amount of time using the 'sleep()' method. During this time, the thread does not respond to any incoming events or execute any code.
| Is This Answer Correct ? | 0 Yes | 0 No |
How many return statement are allowed in a function?
Where is the singleton class used?
Can we store variables in local blocks?
ublic class Java_Coding_Samples { public static void JavaHungr(NumberFormatException ae){ System.out.println("integer"); } public static void JavaHungry(Exception e){ System.out.println("string"); } public static void JavaHungry(ArithmeticException ae){ System.out.println("object"); } public static void main(String[] args) { JavaHungry(null); }
What is type parameter in java?
In the below example, how many string objects are created?
What is the difference between stringbuffer and stringbuilder class?
What advantage do java's layout managers provide over traditional windowing systems?
Lowest Common ancestor in a Binary Search Tree and Binary Tree.
what is the use of clone method? why user cant overwrite in sub class without its proper defination.
How do you sort words in java?
What do you mean by inner class in java?