Core Java - Interview Questions and Answers

271. When two threads are waiting on each other and can't proceed the program is said to be in a deadlock?
True/False

Ans : True

272.Which of the following is true?
1) wait(),notify(),notifyall() are defined as final & can be called only from with in a synchronized method
2) Among wait(),notify(),notifyall() the wait() method only throws IOException
3) wait(),notify(),notifyall() & sleep() are methods of object class
1
2
3
1 & 2
1,2 & 3

Ans : D

273. Garbage collector thread belongs to which priority?

Ans : low-priority

274. What is meant by timeslicing or time sharing?

Ans : Timeslicing is the method of allocating CPU time to individual threads in a priority schedule.

275. What is meant by daemon thread? In java runtime, what is it's role?

Ans : Daemon thread is a low priority thread which runs intermittently in the background doing the garbage collection operation for the java runtime system.


Inheritance

276. What is the difference between superclass & subclass?

Ans : A super class is a class that is inherited whereas subclass is a class that does the inheriting.

277. Which keyword is used to inherit a class?

Ans : extends

278. Subclasses methods can access superclass members/ attributes at all times?
True/False

Ans : False

279. When can subclasses not access superclass members?

Ans : When superclass is declared as private.

280. Which class does begin Java class hierarchy?

Ans : Object class

Post a Comment

Mới hơn Cũ hơn