151. What Are Order Of Precedence & Associativity & How Are They Used?
Answer: Order of precedence determines the order in which operators are evaluated in expressions. Associativity determines whether an expression is evaluated left-to-right or right-to-left.
152. What Is Type Casting? What Is Downcasting? Can A Double Value Be Cast To A Byte?
Answer: Type casting means treating a variable of one type as though it is another type.
Downcasting is the casting from a general to a more specific type, i.e. casting down the hierarchy.
Yes, a double value can be cast to a byte.
153. Which Method Of The Component Class Is Used To Set The Position & Size Of A Component?
Answer: setBounds method is used for this purpose.
154. What Is The Range Of The Short Type?
Answer: The range of the short type is -2^15 to 2^15 - 1.
155. What Is The Immediate Superclass Of Menu?
Answer: MenuItem class
156. Does Java Allow Default Arguments?
Answer: No, Java does not allow Default Arguments.
157. Which Number Is Denoted By Leading Zero In Java? Which Number Is Denoted By Leading 0x Or 0X In Java?
Answer: Octal Numbers are denoted by leading zero in java, example: 06
Hexadecimal Numbers are denoted by leading 0x or 0X in java, example − 0XF
158. Break Statement Can Be Used As Labels In Java?
Answer: Yes, an example can be break one;
159. Where Import Statement Is Used In A Java Program?
Answer: Import statement is allowed at the beginning of the program file after package statement.
160. What Are The Steps Involved In A Life Cycle Of An Applet?
Answer: Life cycle involves the following steps:
161. Why Is The Role Of init Method Under Applets?
Answer: It initializes the applet and is the first method to be called.
162. Which Method Is Called By Applet Class To Load An Image?
Answer: getImageURLobject, filename is used for this purpose.
163. Define Code As An Attribute Of Applet?
Answer: It is used to specify the name of the applet class.
164. Define Canvas?
Answer: It is a simple drawing surface which are used for painting images or to perform other graphical operations.
165. Define Network Programming?
Answer: It refers to writing programs that execute across multiple devices computers, in which the devices are all connected to each other using a network.
166. What Is A Socket? State The Advantages & Disadvantages Of Sockets?
Answer: Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server.
Advantage: Sockets are flexible and sufficient. Efficient socket based programming can be easily implemented for general communications. It cause low network traffic.
Disadvantage: Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way.
167. Which Class Is Used By Server Applications To Obtain A Port & Listen For Client Requests?
Answer: java.net.ServerSocket class is used by server applications to obtain a port and listen for client requests
168. Which Class Represents The Socket That Both The Client & Server Use To Communicate With Each Other?
Answer: java.net.Socket class represents the socket that both the client and server use to communicate with each other.
169. Why Generics Are Used In Java?
Answer: Generics provide compile-time type safety that allows programmers to catch invalid types at compile time. Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods or, with a single class declaration, a set of related types.
170. What Environment Variables Do I Need To Set On My Machine In Order To Be Able To Run Java Programs?
Answer: CLASSPATH and PATH are the two variables.
171. Is There Any Need To Import java.lang Package?
Answer: No, there is no need to import this package. It is by default loaded internally by the JVM.
172. What Is Externalizable Interface?
Answer: Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism.
173. If System.exit 0; Is Written At The End Of The Try Block, Will The Finally Block Still Execute?
Answer: No in this case the finally block will not execute because when you say System.exit 0; the control immediately goes out of the program, and thus finally never executes.
174. What Is The GregorianCalendar Class?
Answer: The GregorianCalendar provides support for traditional Western calendars
175. What Is The SimpleTimeZone Class?
Answer: The SimpleTimeZone class provides support for a Gregorian calendar .
Check Out Other Questions As Well: -
176. What Is The Difference Between The Size & Capacity Of A Vector?
177. Can A Vector Contain Heterogenous Objects?
178. What Is An Enumeration?
179. What Is Difference Between Path & Classpath?
180. Can A Class Declared As Private Be Accessed Outside It's Package?
181. What Are The Restriction Imposed On A Static Method Or A Static Block Of Code?
182. What Is An Object's Lock & Which Object's Have Locks?
183. What Is The Difference Between Inner Class & Nested Class?
184. What Restrictions Are Placed On Method Overriding?
185. What Will Be The Default Values Of All The Elements Of An Array Defined As An Instance Variable?
...Return To Java FAQ's Section
Answer: Order of precedence determines the order in which operators are evaluated in expressions. Associativity determines whether an expression is evaluated left-to-right or right-to-left.
152. What Is Type Casting? What Is Downcasting? Can A Double Value Be Cast To A Byte?
Answer: Type casting means treating a variable of one type as though it is another type.
Downcasting is the casting from a general to a more specific type, i.e. casting down the hierarchy.
Yes, a double value can be cast to a byte.
Answer: setBounds method is used for this purpose.
154. What Is The Range Of The Short Type?
Answer: The range of the short type is -2^15 to 2^15 - 1.
155. What Is The Immediate Superclass Of Menu?
Answer: MenuItem class
156. Does Java Allow Default Arguments?
Answer: No, Java does not allow Default Arguments.
157. Which Number Is Denoted By Leading Zero In Java? Which Number Is Denoted By Leading 0x Or 0X In Java?
Answer: Octal Numbers are denoted by leading zero in java, example: 06
Hexadecimal Numbers are denoted by leading 0x or 0X in java, example − 0XF
158. Break Statement Can Be Used As Labels In Java?
Answer: Yes, an example can be break one;
159. Where Import Statement Is Used In A Java Program?
Answer: Import statement is allowed at the beginning of the program file after package statement.
160. What Are The Steps Involved In A Life Cycle Of An Applet?
Answer: Life cycle involves the following steps:
- Initialization
- Starting
- Stopping
- Destroying
- Painting
161. Why Is The Role Of init Method Under Applets?
Answer: It initializes the applet and is the first method to be called.
162. Which Method Is Called By Applet Class To Load An Image?
Answer: getImageURLobject, filename is used for this purpose.
163. Define Code As An Attribute Of Applet?
Answer: It is used to specify the name of the applet class.
164. Define Canvas?
Answer: It is a simple drawing surface which are used for painting images or to perform other graphical operations.
165. Define Network Programming?
Answer: It refers to writing programs that execute across multiple devices computers, in which the devices are all connected to each other using a network.
166. What Is A Socket? State The Advantages & Disadvantages Of Sockets?
Answer: Sockets provide the communication mechanism between two computers using TCP. A client program creates a socket on its end of the communication and attempts to connect that socket to a server.
Advantage: Sockets are flexible and sufficient. Efficient socket based programming can be easily implemented for general communications. It cause low network traffic.
Disadvantage: Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way.
167. Which Class Is Used By Server Applications To Obtain A Port & Listen For Client Requests?
Answer: java.net.ServerSocket class is used by server applications to obtain a port and listen for client requests
168. Which Class Represents The Socket That Both The Client & Server Use To Communicate With Each Other?
Answer: java.net.Socket class represents the socket that both the client and server use to communicate with each other.
169. Why Generics Are Used In Java?
Answer: Generics provide compile-time type safety that allows programmers to catch invalid types at compile time. Java Generic methods and generic classes enable programmers to specify, with a single method declaration, a set of related methods or, with a single class declaration, a set of related types.
170. What Environment Variables Do I Need To Set On My Machine In Order To Be Able To Run Java Programs?
Answer: CLASSPATH and PATH are the two variables.
171. Is There Any Need To Import java.lang Package?
Answer: No, there is no need to import this package. It is by default loaded internally by the JVM.
172. What Is Externalizable Interface?
Answer: Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism.
173. If System.exit 0; Is Written At The End Of The Try Block, Will The Finally Block Still Execute?
Answer: No in this case the finally block will not execute because when you say System.exit 0; the control immediately goes out of the program, and thus finally never executes.
174. What Is The GregorianCalendar Class?
Answer: The GregorianCalendar provides support for traditional Western calendars
175. What Is The SimpleTimeZone Class?
Answer: The SimpleTimeZone class provides support for a Gregorian calendar .
Check Out Other Questions As Well: -
176. What Is The Difference Between The Size & Capacity Of A Vector?
177. Can A Vector Contain Heterogenous Objects?
178. What Is An Enumeration?
179. What Is Difference Between Path & Classpath?
180. Can A Class Declared As Private Be Accessed Outside It's Package?
181. What Are The Restriction Imposed On A Static Method Or A Static Block Of Code?
182. What Is An Object's Lock & Which Object's Have Locks?
183. What Is The Difference Between Inner Class & Nested Class?
184. What Restrictions Are Placed On Method Overriding?
185. What Will Be The Default Values Of All The Elements Of An Array Defined As An Instance Variable?
...Return To Java FAQ's Section
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com