76. What Is Function Overriding?
Answer: If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.
77. Difference Between Overloading & Overriding?
Answer: Method overloading increases the readability of the program. Method overriding provides the specific implementation of the method that is already provided by its super class parameter must be different in case of overloading, parameter must be same in case of overriding.
78. What Is Final Class?
Answer: Final classes are created so the methods implemented by that class cannot be overridden. It can’t be inherited.
79. What Is NullPointerException?
Answer: A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.
80. What Are The Ways In Which A Thread Can Enter The Waiting State?
Answer: A thread can enter the waiting state by invoking its sleep method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait method. It can also enter the waiting state by invoking its deprecated suspend method.
81. How Does Multithreading Take Place On A Computer With A Single CPU?
Answer: The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
82. What Invokes A Thread's Run Method?
Answer: After a thread is started, via its start method of the Thread class, the JVM invokes the thread's run method when the thread is initially executed.
83. Does It Matter In What Order Catch Statements For FileNotFoundException & IOException Are Written?
Answer: Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.
84. What Is The Difference Between Yielding & Sleeping?
Answer: When a task invokes its yield method, it returns to the ready state. When a task invokes its sleep method, it returns to the waiting state.
85. Why Vector Class Is Used?
Answer: The Vector class provides the capability to implement a growable array of objects. Vector proves to be very useful if you don't know the size of the array in advance, or you just need one that can change sizes over the lifetime of a program.
86. How Many Bits Are Used To Represent Unicode, ASCII, UTF-16, & UTF-8 Characters?
Answer: Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.
87. What Are Wrapper Classes?
Answer: These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.
88. What Is The Difference Between A Window & A Frame?
Answer: The Frame class extends Window to define a main application window that can have a menu bar.
89. Which Package Has Light Weight Components?
Answer: javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.
90. What Is The Difference Between The paint & repaint Methods?
Answer: The paint method supports painting via a Graphics object. The repaint method is used to cause paint to be invoked by the AWT painting thread.
91. What Is The Purpose Of File Class?
Answer: It is used to create objects that provide access to the files and directories of a local file system.
92. What Is The Difference Between The Reader/Writer Class Hierarchy & The InputStream/OutputStream Class Hierarchy?
Answer: The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
93. Which Class Should You Use To Obtain Design Information About An Object?
Answer: The Class class is used to obtain information about an object's design and java.lang.Class class instance represent classes, interfaces in a running Java application.
94. What Is The Difference Between Static & Nonstatic Variables?
Answer: A static variable is associated with the class as a whole rather than with specific instances of a class. Nonstatic variables take on unique values with each object instance.
95. What Is Serialization & Deserialization?
Answer: Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.
96. What Are Use Cases?
Answer: It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance.
97. Explain The Use Of subclass In A Java Program?
Answer: Subclass inherits all the public and protected methods and the implementation. It also inherits all the default modifier methods and their implementation.
98. How To Add Menu Shortcut To Menu Item?
Answer: If there is a button instance called b1, you may add menu shortcut by calling b1.setMnemonic ′F′, so the user may be able to use Alt+F to click the button.
99. Can You Write A Java Class That Could Be Used Both As An Applet As Well As An Application?
Answer: Yes, just add a main method to the applet.
100. What Is The Difference Between Swing & AWT Components?
Answer: AWT components are heavyweight, whereas Swing components are lightweight. Heavyweight components depend on the local windowing toolkit. For example, java.awt.Button is a heavyweight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.
Check Out Other Questions As Well: -
101. What's The Difference Between Constructors & Other Methods?
102. Is There Any Limitation Of Using Inheritance?
103. When Is The ArrayStoreException Thrown?
104. Can You Call One Constructor From Another If A Class Has Multiple Constructors?
105. What's The Difference Between The Methods Sleep & Wait?
106. When ArithmeticException Is Thrown?
107. What Is A Transient Variable?
108. What Is Synchronization?
109. What Is The Collections API?
110. Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
111. What Is The Immediate Superclass Of The Applet Class?
112. Which Java Operator Is Right Associative?
113. What Is The Difference Between A Break Statement & A Continue Statement?
114. If A Variable Is Declared As Private, Where May The Variable Be Accessed?
115. What Is The Purpose Of The System Class?
116. List Primitive Java Types?
117. What Is The Relationship Between Clipping & Repainting Under AWT?
118. Which Class Is The Immediate Superclass Of The Container Class?
119. What Class Of Exceptions Are Generated By The Java Run-Time System?
120. Under What Conditions Is An Object's Finalize Method Invoked By The Garbage Collector?
121. How Can A Dead Thread Be Restarted?
122. Which Arithmetic Operations Can Result In The Throwing Of An ArithmeticException? Variable Of The Boolean Type Is Automatically Initialized As?
123. How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception? Can Try Statements Be Nested?
124. Is It Necessary That Each Try Block Must Be Followed By A Catch Block?
125. What Are Class Loaders?
...Return To Java FAQ's Section
Answer: If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.
77. Difference Between Overloading & Overriding?
Answer: Method overloading increases the readability of the program. Method overriding provides the specific implementation of the method that is already provided by its super class parameter must be different in case of overloading, parameter must be same in case of overriding.
78. What Is Final Class?
Answer: Final classes are created so the methods implemented by that class cannot be overridden. It can’t be inherited.
79. What Is NullPointerException?
Answer: A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.
80. What Are The Ways In Which A Thread Can Enter The Waiting State?
Answer: A thread can enter the waiting state by invoking its sleep method, by blocking on IO, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait method. It can also enter the waiting state by invoking its deprecated suspend method.
81. How Does Multithreading Take Place On A Computer With A Single CPU?
Answer: The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
82. What Invokes A Thread's Run Method?
Answer: After a thread is started, via its start method of the Thread class, the JVM invokes the thread's run method when the thread is initially executed.
83. Does It Matter In What Order Catch Statements For FileNotFoundException & IOException Are Written?
Answer: Yes, it does. The FileNoFoundException is inherited from the IOException. Exception's subclasses have to be caught first.
84. What Is The Difference Between Yielding & Sleeping?
Answer: When a task invokes its yield method, it returns to the ready state. When a task invokes its sleep method, it returns to the waiting state.
85. Why Vector Class Is Used?
Answer: The Vector class provides the capability to implement a growable array of objects. Vector proves to be very useful if you don't know the size of the array in advance, or you just need one that can change sizes over the lifetime of a program.
86. How Many Bits Are Used To Represent Unicode, ASCII, UTF-16, & UTF-8 Characters?
Answer: Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.
87. What Are Wrapper Classes?
Answer: These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.
88. What Is The Difference Between A Window & A Frame?
Answer: The Frame class extends Window to define a main application window that can have a menu bar.
89. Which Package Has Light Weight Components?
Answer: javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.
90. What Is The Difference Between The paint & repaint Methods?
Answer: The paint method supports painting via a Graphics object. The repaint method is used to cause paint to be invoked by the AWT painting thread.
91. What Is The Purpose Of File Class?
Answer: It is used to create objects that provide access to the files and directories of a local file system.
92. What Is The Difference Between The Reader/Writer Class Hierarchy & The InputStream/OutputStream Class Hierarchy?
Answer: The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
93. Which Class Should You Use To Obtain Design Information About An Object?
Answer: The Class class is used to obtain information about an object's design and java.lang.Class class instance represent classes, interfaces in a running Java application.
94. What Is The Difference Between Static & Nonstatic Variables?
Answer: A static variable is associated with the class as a whole rather than with specific instances of a class. Nonstatic variables take on unique values with each object instance.
95. What Is Serialization & Deserialization?
Answer: Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.
96. What Are Use Cases?
Answer: It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance.
97. Explain The Use Of subclass In A Java Program?
Answer: Subclass inherits all the public and protected methods and the implementation. It also inherits all the default modifier methods and their implementation.
98. How To Add Menu Shortcut To Menu Item?
Answer: If there is a button instance called b1, you may add menu shortcut by calling b1.setMnemonic ′F′, so the user may be able to use Alt+F to click the button.
99. Can You Write A Java Class That Could Be Used Both As An Applet As Well As An Application?
Answer: Yes, just add a main method to the applet.
100. What Is The Difference Between Swing & AWT Components?
Answer: AWT components are heavyweight, whereas Swing components are lightweight. Heavyweight components depend on the local windowing toolkit. For example, java.awt.Button is a heavyweight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button.
Check Out Other Questions As Well: -
101. What's The Difference Between Constructors & Other Methods?
102. Is There Any Limitation Of Using Inheritance?
103. When Is The ArrayStoreException Thrown?
104. Can You Call One Constructor From Another If A Class Has Multiple Constructors?
105. What's The Difference Between The Methods Sleep & Wait?
106. When ArithmeticException Is Thrown?
107. What Is A Transient Variable?
108. What Is Synchronization?
109. What Is The Collections API?
110. Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
111. What Is The Immediate Superclass Of The Applet Class?
112. Which Java Operator Is Right Associative?
113. What Is The Difference Between A Break Statement & A Continue Statement?
114. If A Variable Is Declared As Private, Where May The Variable Be Accessed?
115. What Is The Purpose Of The System Class?
116. List Primitive Java Types?
117. What Is The Relationship Between Clipping & Repainting Under AWT?
118. Which Class Is The Immediate Superclass Of The Container Class?
119. What Class Of Exceptions Are Generated By The Java Run-Time System?
120. Under What Conditions Is An Object's Finalize Method Invoked By The Garbage Collector?
121. How Can A Dead Thread Be Restarted?
122. Which Arithmetic Operations Can Result In The Throwing Of An ArithmeticException? Variable Of The Boolean Type Is Automatically Initialized As?
123. How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception? Can Try Statements Be Nested?
124. Is It Necessary That Each Try Block Must Be Followed By A Catch Block?
125. What Are Class Loaders?
...Return To Java FAQ's Section
Ni Hau,
ReplyDeleteGasping at your brilliance! Thanks a tonne for sharing all that content. Can’t stop reading. Honestly!
I create an instance of javax.xml.transform.TransformerFactory and directly afterwards I parse a xsltSource:
Java Code:
1
2
3
4
5
6
7 protected synchronized Transformer getTransformer(Source xsltSource)
throws TransformerConfigurationException {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(xsltSource);
return transformer;
}
I am using the com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerFactoryImpl com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerImpl classes.
Which are the ones provided by the JDK.