Core java interview Questions You'll Most Likely Be Asked (Second Edition)
Download 1.52 Mb. Pdf ko'rish
|
Core JAVA Interview Questions Youll M...
Scenario Based Ques ons
Suppose you create a new thread by extending the Thread class and you invoke the start method multiple times. What do you think will happen? Suppose you have a method that returns an integer value. The code is present within a try/catch/finally. There is a return statement in the try, catch and finally blocks. The return statement in the try block returns 1, the return statement in the catch block returns–1 and the return statement in the finally 283. 284. 285. 286. 287. 288. 289. 290. block returns 0. If an exception occurs, which value will be returned? Suppose you have a static method in the Base class. And suppose you have a method with the same name in the sub– class. And suppose you create a Base class object and assign it a reference of the sub–class object and invoke the static method. Is this valid? If so, which version of the static method gets invoked? Suppose you have a method in a base class that throws an ArrayIndexOutOfBoundsException. And suppose this method is overridden in the sub–class and declares that it throws a RuntimeException. What do you think will happen? Suppose you have a List of objects. You want to send it as a parameter to a client application but want to ensure that the client application does not make changes to it. How can you achieve this? Suppose you are reading 10000 String values from the database. You need to create a concatenated String with these values. Which is the most efficient way to achieve this? Suppose you are developing an application that performs a lot of mathematical calculations involving very large decimal numbers. Which data type will you use for your variables given that precision is important? Suppose you are working on a multi–threaded application. A new requirement comes in where you need to store key–value pairs. Which is the most appropriate Collection to be used in such a scenario? Suppose you need to create some utility methods in your application. What is the best practice for creating such methods? Where would you place them? Suppose you have developed an interface called FileWriter as 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