Subscribe Us

Core Java - Interview Questions and Answers

MULTI THREADING

251. What are the two types of multitasking?

1.process-based
2.Thread-based

252. What are the two ways to create the thread?

1.by implementing Runnable
2.by extending Thread

253. What is the signature of the constructor of a thread class?

Ans : Thread(Runnable threadob,String threadName)

254. What are all the methods available in the Runnable Interface?

Ans : run()

255. What is the data type for the method isAlive() and this method is
available in which class?

Ans : boolean, Thread

256. What are all the methods available in the Thread class?

1.isAlive()
2.join()
3.resume()
4.suspend()
5.stop()
6.start()
7.sleep()
8.destroy()

257. What are all the methods used for Inter Thread communication and what is the class in which these methods are defined?

Ans :1. wait(),notify() & notifyall()
2. Object class

258. What is the mechanisam defind by java for the Resources to be used by only one Thread at a time?

Ans : Synchronisation

259. What is the procedure to own the monitor by many threads?

Ans : not possible

260. What is the unit for 1000 in the below statement?

ob.sleep(1000)
Ans : long milliseconds

Post a Comment

0 Comments