How To Repair Finding Threads (Solved) Home > How To > Finding Threads

Finding Threads


Close Menu Java Programming - Threads Home » Engineering » Java Programming » Threads » Finding the output Exercise :: Threads - Finding the outputThreads - General QuestionsThreads - Finding the Quantitive Aptitude Arithmetic Aptitude Data Interpretation Verbal and Reasoning Verbal Ability Logical Reasoning Verbal Reasoning Nonverbal Reasoning Interview HR Interview Group Discussion Placement Papers Technical Interview Engineering Mechanical Engineering Civil Engineering What will be the output of the program? fooB.

class MyThread extends Thread { public static void main(String [] args) { MyThread t = new MyThread(); t.start(); System.out.print("one. "); t.start(); System.out.print("two. "); } public void run() { System.out.print("Thread "); } What will be the output of the program? The next statement in main invokes start() on the new thread instance, which causes the overridden run() method (the run() method defined in the anonymous inner class) to be invoked, which Name : Email: View Answer Discuss in Forum Workspace Report 2.

How To Measure Thread Diameter

class MyThread extends Thread { MyThread() { System.out.print(" MyThread"); } public void run() { System.out.print(" bar"); } public void run(String s) { System.out.println(" baz"); } } public class TestThreads { public foo bar Answer: Option B Explanation: Option B is correct because in the first line of main we're constructing an instance of an anonymous inner class extending from MyThread. Medical Science Microbiology Biochemistry Biotechnology Biochemical Engineering Others General Knowledge Puzzles Quiz Sudoku Online Tests Ask your question?

MyThread fooC. So the MyThread constructor runs and prints "MyThread". MyThread barD. How To Measure Thread Pitch Diameter Technical C Programming C++ C# Java Database Networking Read more...