Core java interview Questions You'll Most Likely Be Asked (Second Edition)
Enumera ons, Autoboxing and Wrapper
Download 1.52 Mb. Pdf ko'rish
|
Core JAVA Interview Questions Youll M...
- Bu sahifa navigatsiya:
- Miscellaneous
Enumera ons, Autoboxing and Wrapper
Classes What are the wrapper classes available in Java? What will be the output of the following code? Explain how you will convert a String “100.55” to a Double and a Double 100.55 to a String. What will be the output the following code? What is a Wrapper class in Java? What are the special properties of Wrapper class objects? Explain Autoboxing with an example. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. Threads How will you create Threads in Java? Explain the different types of Threads in Java. Can the run method be invoked directly without invoking the start method? What happens behind the scenes when the following code is executed? Explain some of the main methods in the Thread class. Explain thread states. Write a code sample that creates a thread using the “Thread” class. Write a code sample that creates a thread using the Runnable interface. Is it possible to create more than one thread in a Java application? If so, how will the threads communicate with each other? What is Synchronization? Explain what happens when the following code is executed. Consider the following code: Executing this code first prints “Thread 1” 1000 times and then prints the “Thread 2” 1000 times. If this is incorrect, explain the reasons. Write a code sample that makes a thread pause for ten minutes. What happens when a synchronized method is invoked? Java IO API 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. What happens when the following code is executed? Write a code sample that creates a file in the path /usr/test.txt. Explain the FileWriter class with a code sample. Write a code snippet that reads the content in the file /usr/CoreJava.txt using a FileReader and displays the output in the console. Explain with a code sample how you can create a directory on the file system. Explain what happens when the following code is compiled and executed. Write a code sample that demonstrates the PrintWriter class. Write a code sample that demonstrates how to delete a file. Write a code sample that demonstrates how to rename a file or directory. Which classes are used to serialize and de–serialize objects? Explain some of the important methods on the File class. Miscellaneous Explain what happens when the following code snippet is compiled. Explain what happens when the following code is compiled and executed. Explain symmetric equals() contract. Which of the following are invalid statements and why? What is the use of transient keyword? What is Garbage Collection in Java? Which part of the memory is used in Garbage Collection? Which algorithm does the JVM use for Garbage collection? 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. When does garbage collection occur? What code needs to be written in order to trigger garbage collection? Explain with a code sample how an object becomes eligible for garbage collection. Download 1.52 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling