- Can a lock be acquired on a class? - Yes, a lock can be acquired on a class. This lock is acquired on the class’s Class object.
- What state does a thread enter when it terminates its processing? - When a thread terminates its processing, it enters the dead state.
- How does Java handle integer overflows and underflows? - It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.
- What is the difference between the >> and >>> operators? - The >> operator carries the sign bit when shifting right. The >>> zero-fills bits that have been shifted out.
- Is sizeof a keyword? - The sizeof operator is not a keyword.
- Does garbage collection guarantee that a program will not run out of memory? - Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection
See Java Interview Questions and Answers : Part 1 for more Java/J2EE Interview Questions.