Thursday, October 25, 2007

Java Interview Questions -Part 12


8. Can you make an instance of an abstract class? For example - java.util.Calender is an abstract class with a method getInstance() which returns an instance of the Calender 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.
9. What is the output of xWhen this kind of question has been asked, find the problems you think is necessary to ask before you give an answer. Ask if variables a and b have been declared or initialized. If the answer is yes. You can say that the syntax is wrong. If the statement is rewritten as: x10. What is the 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.
11. 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.
12. 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.
DOM SAX
----------------------------------------------------------------

1. Tree of nodes 1.Sequence of events

2.Memory: Occupies more memory, 2.does'nt use any memory

preffered for small XML documents preferred for large documents

3.Slower at runtime 3. Faster at runtime

4.stored as objects 4. objects are to be created

5.Programmatically easy, since objects 5.Need to write code for creating objects

are to reffered

6.Ease of navigation 6.backward navigation is not possible as

0 comments:

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com