Wednesday, June 15, 2011

java interview questions

1. why java?

-: java is a fun and challenging language.
-: Object Oriented
-: Better Portability
-: Multi-Threading
-: Memory Management(Garbage Collection)
-: supports Web Based, Standalone, Distributed Application
-: superb API and
-: Open Source.

2. static vs. dynamic class loading?

Static Class Loading

-: Class are statically loaded with java's "new" operator
ex :
class car {
public static void main(String args[]) {
Car c = new Car();
}
}
Exception

NoClassDefFoundException
Dynamic Loading

- : its a technique for programmatic invoke the function of a class loader at run time.

Ex:

Class.forName("Class Name");// static method will return the class

class.newInstance();// Non Static method will create a new instance(object) of class

Exception

ClassNotFoundException

No comments:

Post a Comment