Saturday, January 27, 2007

Parsers? DOM vs SAX parser

parsers are fundamental xml components, a bridge between XML documents and applications that process that XML. The parser is responsible for handling xml syntax, checking the contents of the document against constraints established in a DTD or Schema.

SOURCE : www.referjava.com

Why Java does not support pointers?

Because pointers are unsafe. Java uses reference types to hide pointers and programmers feel easier to deal with reference types without pointers. This is why Java and C# shine.


SOURCE : www.referjava.com

difference between Swing and AWT components?

AWT components are heavy-weight, whereas Swing components are lightweight. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.

SOURCE : www.referjava.com

Can you make an instance of an abstract class?

No! You cannot make an instance of an abstract class. An abstract class has to be sub-classed. If you have an abstract class and you want to use a method which has been implemented, you may need to subclass that abstract class, instantiate your subclass and then call that method.

SOURCE : www.referjava.com

Where and how can you use a private constructor.

Private constructor can be used if you do not want any other class to instanstiate the object , the instantiation is done from a static public method, this method is used when dealing with the factory method pattern when the designer wants only one controller (fatory method ) to create the object.


SOURCE : www.referjava.com

difference between final, finally and finalize?

final - declare constant
o finally - handles exception
o finalize - helps in garbage collection.


SOURCE : www.referjava.com

Can a private method of a superclass be declared within a subclass?

Sure. A private field or method or inner class belongs to its declared class and hides from its subclasses. There is no way for private stuff to have a runtime overloading or overriding (polymorphism) features.


SOURCE : www.referjava.com