Tuesday, April 24, 2007

Java

These question are collected from some sites & I feel these are interesting to be discussed here.
1. How does the Java virtual machine handle the problem of name collisions, where two different classes have the same name?


  1. The VM assigns a pseudo name to each class.
  2. Name collisions are illegal - they are treated as exceptions.
  3. The VM cannot distinguish between two different classes with the same name
  4. The VM treats different classes loaded by different class loaders as different types, even if

2. What guarantees does the Java Virtual Machine1 Specification make regarding objects that provide a finalize method?
  1. These objects are given priority during garbage collection.
  2. The finalize method is called before the object is collected
  3. The finalize method is called after the object is collected
  4. The object is collected directly after the finalize method is called.

No comments: