101. What's The Difference Between Constructors & Other Methods?
Answer: Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.
102. Is There Any Limitation Of Using Inheritance?
Answer: Yes, since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation.
103. When Is The ArrayStoreException Thrown?
Answer: When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown.
104. Can You Call One Constructor From Another If A Class Has Multiple Constructors?
Answer: Yes, use this syntax.
105. What's The Difference Between The Methods Sleep & Wait?
Answer: The code sleep2000; puts thread aside for exactly two seconds. The code wait2000, causes a wait of up to two second. A thread could stop waiting earlier if it receives the notify or notifyAll call. The method wait is defined in the class Object and the method sleep is defined in the class Thread.
106. When ArithmeticException Is Thrown?
Answer: The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. It is never thrown in floating-point operations.
107. What Is A Transient Variable?
Answer: A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization,
108. What Is Synchronization?
Answer: Synchronization is the capability to control the access of multiple threads to shared resources. synchronized keyword in java provides locking which ensures mutual exclusive access of shared resource and prevent data race.
109. What Is The Collections API?
Answer: The Collections API is a set of classes and interfaces that support operations on collections of objects.
110. Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
Answer: Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.
111. What Is The Immediate Superclass Of The Applet Class?
Answer: Panel is the immediate superclass. A panel provides space in which an application can attach any other component, including other panels.
112. Which Java Operator Is Right Associative?
Answer: The = operator is right associative.
113. What Is The Difference Between A Break Statement & A Continue Statement?
Answer: A break statement results in the termination of the statement to which it applies switch, for, do, or while. A continue statement is used to end the current loop iteration and return control to the loop statement.
114. If A Variable Is Declared As Private, Where May The Variable Be Accessed?
Answer: A private variable may only be accessed within the class in which it is declared.
115. What Is The Purpose Of The System Class?
Answer: The purpose of the System class is to provide access to system resources.
116. List Primitive Java Types?
Answer: The eight primitive types are byte, char, short, int, long, float, double, and boolean.
117. What Is The Relationship Between Clipping & Repainting Under AWT?
Answer: When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
118. Which Class Is The Immediate Superclass Of The Container Class?
Answer: Component class is the immediate super class.
119. What Class Of Exceptions Are Generated By The Java Run-Time System?
Answer: The Java runtime system generates RuntimeException and Error exceptions.
120. Under What Conditions Is An Object's Finalize Method Invoked By The Garbage Collector?
Answer: The garbage collector invokes an object's finalize method when it detects that the object has
become unreachable.
121. How Can A Dead Thread Be Restarted?
Answer: A dead thread cannot be restarted.
122. Which Arithmetic Operations Can Result In The Throwing Of An ArithmeticException? Variable Of The Boolean Type Is Automatically Initialized As?
Answer: Integer / and % can result in the throwing of an ArithmeticException. The default value of the boolean type is false.
123. How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception? Can Try Statements Be Nested?
Answer: When an exception is thrown within the body of a try statement, the catch clauses of the try
statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.
Yes, try statement can be nested.
124. Is It Necessary That Each Try Block Must Be Followed By A Catch Block?
Answer: It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block.
125. What Are Class Loaders?
Answer: A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class.
Check Out Other Questions As Well: -
126. What Is The Difference Between An Interface & An Abstract Class?
127 .Can An Interface Extend Another Interface?
128. If A Method Is Declared As Protected, Where May The Method Be Accessed?
129. What Will Happen If Static Modifier Is Removed From The Signature Of The Main Method?
130. What Is The Default Value Of An Object Reference Declared As An Instance Variable?
131. What Is Nested Top-Level Class? Can A Top Level Class Be Private Or Protected?
132 .Why Do We Need wrapper Classes?
133. What Is The Difference Between Error & An Exception?
134. Describe Life Cycle Of Thread?
135. When A Thread Is Created & Started, What Is Its Initial State?
136. Explain Suspend, isAlive Method Under Thread Class? What Is currentThread?
137. Explain Main Thread Under Thread Class Execution?
138. What Is Daemon Thread? Which Method Is Used To Create The Daemon Thread? Which Method Must Be Implemented By All Threads?
139. What Is The Locale Class?
140. What Are Synchronized Methods & Synchronized Statements?
141. What Is Runtime Polymorphism Or Dynamic Method Dispatch?
142. Which Object Oriented Concept Is Achieved By Using Overloading & Overriding?
143. What Is Dynamic Binding?
144. Can Constructor Be Inherited? Where & How Can You Use A Private Constructor?
145. What Is Constructor Chaining & How Is It Achieved In Java?
146. What Are The Advantages Of ArrayList Over Arrays?
147. Why Deletion In LinkedList Is Fast Than ArrayList?
148. How Do You Decide When To Use ArrayList & LinkedList?
149. What Is A Values Collection View ?
150. What Is Dot Operator? What Is The Difference Between The >> and >>> Operators?
...Return To Java FAQ's Section
Answer: Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times.
102. Is There Any Limitation Of Using Inheritance?
Answer: Yes, since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation.
103. When Is The ArrayStoreException Thrown?
Answer: When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown.
104. Can You Call One Constructor From Another If A Class Has Multiple Constructors?
Answer: Yes, use this syntax.
105. What's The Difference Between The Methods Sleep & Wait?
Answer: The code sleep2000; puts thread aside for exactly two seconds. The code wait2000, causes a wait of up to two second. A thread could stop waiting earlier if it receives the notify or notifyAll call. The method wait is defined in the class Object and the method sleep is defined in the class Thread.
106. When ArithmeticException Is Thrown?
Answer: The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero. It is never thrown in floating-point operations.
107. What Is A Transient Variable?
Answer: A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization,
108. What Is Synchronization?
Answer: Synchronization is the capability to control the access of multiple threads to shared resources. synchronized keyword in java provides locking which ensures mutual exclusive access of shared resource and prevent data race.
109. What Is The Collections API?
Answer: The Collections API is a set of classes and interfaces that support operations on collections of objects.
110. Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
Answer: Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.
111. What Is The Immediate Superclass Of The Applet Class?
Answer: Panel is the immediate superclass. A panel provides space in which an application can attach any other component, including other panels.
112. Which Java Operator Is Right Associative?
Answer: The = operator is right associative.
113. What Is The Difference Between A Break Statement & A Continue Statement?
Answer: A break statement results in the termination of the statement to which it applies switch, for, do, or while. A continue statement is used to end the current loop iteration and return control to the loop statement.
114. If A Variable Is Declared As Private, Where May The Variable Be Accessed?
Answer: A private variable may only be accessed within the class in which it is declared.
115. What Is The Purpose Of The System Class?
Answer: The purpose of the System class is to provide access to system resources.
116. List Primitive Java Types?
Answer: The eight primitive types are byte, char, short, int, long, float, double, and boolean.
117. What Is The Relationship Between Clipping & Repainting Under AWT?
Answer: When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
118. Which Class Is The Immediate Superclass Of The Container Class?
Answer: Component class is the immediate super class.
119. What Class Of Exceptions Are Generated By The Java Run-Time System?
Answer: The Java runtime system generates RuntimeException and Error exceptions.
120. Under What Conditions Is An Object's Finalize Method Invoked By The Garbage Collector?
Answer: The garbage collector invokes an object's finalize method when it detects that the object has
become unreachable.
121. How Can A Dead Thread Be Restarted?
Answer: A dead thread cannot be restarted.
122. Which Arithmetic Operations Can Result In The Throwing Of An ArithmeticException? Variable Of The Boolean Type Is Automatically Initialized As?
Answer: Integer / and % can result in the throwing of an ArithmeticException. The default value of the boolean type is false.
123. How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception? Can Try Statements Be Nested?
Answer: When an exception is thrown within the body of a try statement, the catch clauses of the try
statement are examined in the order in which they appear. The first catch clause that is capable of handling the exception is executed. The remaining catch clauses are ignored.
Yes, try statement can be nested.
124. Is It Necessary That Each Try Block Must Be Followed By A Catch Block?
Answer: It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block.
125. What Are Class Loaders?
Answer: A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class.
Check Out Other Questions As Well: -
126. What Is The Difference Between An Interface & An Abstract Class?
127 .Can An Interface Extend Another Interface?
128. If A Method Is Declared As Protected, Where May The Method Be Accessed?
129. What Will Happen If Static Modifier Is Removed From The Signature Of The Main Method?
130. What Is The Default Value Of An Object Reference Declared As An Instance Variable?
131. What Is Nested Top-Level Class? Can A Top Level Class Be Private Or Protected?
132 .Why Do We Need wrapper Classes?
133. What Is The Difference Between Error & An Exception?
134. Describe Life Cycle Of Thread?
135. When A Thread Is Created & Started, What Is Its Initial State?
136. Explain Suspend, isAlive Method Under Thread Class? What Is currentThread?
137. Explain Main Thread Under Thread Class Execution?
138. What Is Daemon Thread? Which Method Is Used To Create The Daemon Thread? Which Method Must Be Implemented By All Threads?
139. What Is The Locale Class?
140. What Are Synchronized Methods & Synchronized Statements?
141. What Is Runtime Polymorphism Or Dynamic Method Dispatch?
142. Which Object Oriented Concept Is Achieved By Using Overloading & Overriding?
143. What Is Dynamic Binding?
144. Can Constructor Be Inherited? Where & How Can You Use A Private Constructor?
145. What Is Constructor Chaining & How Is It Achieved In Java?
146. What Are The Advantages Of ArrayList Over Arrays?
147. Why Deletion In LinkedList Is Fast Than ArrayList?
148. How Do You Decide When To Use ArrayList & LinkedList?
149. What Is A Values Collection View ?
150. What Is Dot Operator? What Is The Difference Between The >> and >>> Operators?
...Return To Java FAQ's Section
thnk u so much all java question are very helpful in my interview
ReplyDelete