Java short questions
1. What do you mean by Byte Code?
2. Why java is platform Independent/Architectural Neutral?
3. Explain meaning of following statement:
public static void main(String args[])
4. Can you distinguish between == and equals() method?
5. What is the use of JIT Compiler?
6. Differentiate between length and length ().
7. Write the syntax of object creation of BufferedReader class.
8. What is the use of instanceof operator?
9. Compare static and instance variables.
10. Can you distinguish between overloading and overriding method?
11. Illustrate runtime polymorphism or dynamic method dispatch.
12. Can you provide a definition of final class?
13. Compare static and non-static variables.
14. Differentiate between constructor and method.
15. What is garbage collection? Which method is used to perform explicit garbage collection in java?
16. Differentiate between concrete class and abstract class.
17. What was the underlying theme of finally keyword?
18. What is use of the ‘throws’ keyword?
19. What was the underlying theme of package?
20. Differentiate between abstract class and interface.
21. Compare checked and unchecked exceptions.
22. Why we can’t able to create object of an interface?
23. Differentiate between String and StringBuffer class.
24. Explain the methods sleep () and wait ().
25. Show the use of deserialization.
26. Explain the use of ResultSet in JDBC.
27. Explain the methods notify () and notifyAll().
28. Show the use of serialization.
29. Differentiate between type-3 and type-4 driver.
30. What is the advantage of using Runnable interface over Thread class?
31. Differentiate between ArrayList and Vector.
32. Differentiate between HashSet and HashMap.
33. Differentiate between Iterator and ListIterator. Interface.
34. Mention the significance of Bytecode in Java. Write the meaning of WORA and how it is achieved in Java?
35. Define anonymous objects. Explain use cases of anonymous objects.
36. Find the output with reason
public class CheckProgram {
void hello(){
[Link]("Show() in Check Program");
}
void show(){
[Link]("Show()");
}}
class UncheckProgram extends CheckProgram{
void hello(){
Java short questions
[Link]("Hello()");
}
void bye(){
[Link]("bye()");
}
public static void main(String[] args) {
CheckProgram up=new UncheckProgram();
[Link]();
[Link]();
[Link]();
}}
37. Name the type of exception the following catch block can handle? Is it advisable to use such a handler,
justify your reason.
38. Catch(Exception e)
39. Explain how access modifiers affect the visibility of classes and members across different packages in Java.
40. Write a Java statement to create an ArrayList of strings and add two elements "Java" and "Python" to it.
41. Define thread priority. Explain the different constants used for thread priority. Also, write the syntax to
set and get thread priority in Java.
42. Differentiate between List and Set in Java. Also, provide two use cases for each.
43. Write the steps to establish a database connection using JDBC in Java.
44. Demonstrate autoboxing and unboxing in Java by writing a short code snippet that converts between
primitive types and their corresponding wrapper classes.
45. What is generics in java? How is generics achieved in java?
46. Differentiate between PreparedStatement and CallableStatement.
47. What is this keyword? Explain different uses of it.
48. What is the use of package statement and why do we need a package?
49. What is synchronized methos and how is it different than synchronized block?
50. What do you mean by Wrapper class? Explain few methods of wrapper classes?