At Softloom IT Training, we’re committed to helping you succeed in the tech world. This guide on Java Full Stack Development – Interview Questions and Answers is designed to give you a clear understanding of the core concepts, frameworks, and tools most commonly asked in full-stack development interviews.

1. What is Java?

A) A compiled programming language
B) An interpreted programming language
C) Both compiled and interpreted
D) A markup language

Answer: C) Both compiled and interpreted

2. Which company developed Java?

A) Microsoft
B) Sun Microsystems
C) Google
D) IBM

Answer: B) Sun Microsystems

3. What is the default value of an instance variable of type int in Java?

A) 0
B) null
C) 1
D) Undefined

Answer: A) 0

4. What is the purpose of the JVM?

A) To compile Java code
B) To execute Java bytecode
C) To debug Java programs
D) To format Java code

Answer: B) To execute Java bytecode

5. What is JDK?

A) Java Documentation Kit
B) Java Development Kit
C) Java Debugging Kit
D) Java Deployment Kit

Answer: B) Java Development Kit

6. Which of the following is not a Java feature?

A) Object-Oriented
B) Platform-Independent
C) Automatic Memory Management
D) Pointer Arithmetic

Answer: D) Pointer Arithmetic

7. What is the size of an int in Java?

A) 16 bits
B) 32 bits
C) 64 bits
D) Depends on the operating system

Answer: B) 32 bits

8. Which of the following is used to create an object in Java?

A) new
B) create
C) instance
D) object

Answer: A) new

9. What is the correct syntax to declare a variable in Java?

A) int x;
B) variable int x;
C) x int;
D) declare x as int;

Answer: A) int x;

10. Which access modifier allows a class member to be accessed only within the same package?

A) private
B) protected
C) default
D) public

Answer: C) default

11. Which method is the entry point of a Java application?

A) public void start()
B) public static void main(String[] args)
C) void run()
D) void execute()

Answer: B) public static void main(String[] args)

12. What is the superclass of all classes in Java?

A) Object
B) Main
C) Base
D) Super

Answer: A) Object

13. What keyword is used to inherit a class in Java?

A) extends
B) implements
C) inherit
D) super

Answer: A) extends

14. Which of these allows multiple inheritance in Java?

A) Classes
B) Interfaces
C) Abstract Classes
D) None of the above

Answer: B) Interfaces

15. What is the correct way to declare an abstract method?

A) abstract void display();
B) void abstract display();
C) void display() abstract;
D) display() abstract void;

Answer: A) abstract void display();

16. What is the default value of a Boolean variable?

A) true
B) false
C) 1
D) null

Answer: B) false

17. What will happen if the final keyword is used with a class?

A) The class cannot be inherited
B) The class can only be instantiated once
C) The class cannot be instantiated
D) The class cannot have methods

Answer: A) The class cannot be inherited

18. Which of these statements is used to handle exceptions?

A) catch
B) throw
C) try-catch
D) final

Answer: C) try-catch

19. What does the finally block do in exception handling?

A) Executes only if an exception occurs
B) Executes only if no exception occurs
C) Always executes
D) Never executes

Answer: C) Always executes

20. What is the function of the super keyword?

A) Calls the parent class constructor
B) Calls the child class constructor
C) Calls a private method of the class
D) Calls the main method

Answer: A) Calls the parent class constructor

21. Which data structure is synchronized in Java?

A) ArrayList
B) HashSet
C) Vector
D) LinkedList

Answer: C) Vector

22. What is the base package for the Java Collections Framework?

A) Java.collection
B) Java.util
C) Java.collections
D) Java.list

Answer: B) Java.util

23. How do you declare an array in Java?

A) int[] arr;
B) int arr[];
C) int arr = new int[10];
D) All of the above

Answer: D) All of the above

24. What is the default capacity of an ArrayList in Java?

A) 5
B) 10
C) 15
D) 20

Answer: B) 10

25. Which of these classes is used to handle files in Java?

A) File
B) FilesHandler
C) FileManager
D) FileObject

Answer: A) File

26. What is the output of System.out.println(5/2);?

A) 2
B) 2.5
C) 3
D) Compilation error

Answer: A) 2

27. What does System.out.println(Math.pow(2, 3)); return?

A) 6
B) 8
C) 9
D) 16

Answer: B) 8

28. Which of the following is used for reading input from the console?

A) Scanner
B) InputReader
C) BufferReader
D) FileReader

Answer: A) Scanner

30. Which keyword is used to implement an interface?

A) extends
B) implements
C) interface
D) inherits

Answer: B) implements

30. What is the output of 10 + 20 + “Java” in Java?

A) 30Java
B) Java30
C) Compilation error
D) 10Java20

Answer: A) 30Java

31. Which keyword is used to prevent method overriding?

A) static
B) abstract
C) final
D) protected
Answer: C) final

32. Which of the following is a valid constructor declaration?

A) void MyClass() {}
B) MyClass(void) {}
C) MyClass() {}
D) new MyClass() {}
Answer: C) MyClass() {}

33. Which loop is guaranteed to execute at least once?

A) for loop
B) while loop
C) do-while loop
D) enhanced for loop
Answer: C) do-while loop

34. Which keyword is used to refer to the parent class in Java?

A) this
B) base
C) parent
D) super
Answer: D) super

35. What does the instanceof operator do?

A) Creates an instance
B) Compares memory addresses
C) Checks object type
D) Casts an object
Answer: C) Checks object type

36. Which of these is not a wrapper class in Java?

A) Integer
B) Boolean
C) Float
D) String
Answer: D) String

37. Which method is used to start a thread?

A) execute()
B) run()
C) start()
D) begin()
Answer: C) start()

38. Which exception is thrown when you divide a number by zero?

A) NullPointerException
B) ArithmeticException
C) IOException
D) NumberFormatException
Answer: B) ArithmeticException

39. Which of the following is a checked exception?

A) NullPointerException
B) ArithmeticException
C) IOException
D) ArrayIndexOutOfBoundsException
Answer: C) IOException

40. What does this keyword refer to?

A) The parent class object
B) The current object
C) A static method
D) A global variable
Answer: B) The current object

41. What is the difference between == and .equals() in Java?

A) == compares values, .equals() compares references
B) == compares references, .equals() compares values
C) Both do the same
D) equals () is only used for primitive types
Answer: B

42. Which of the following can be overloaded in Java?

A) Constructors
B) Static methods
C) Instance methods
D) All of the above
Answer: D

43. Which loop guarantees at least one execution?

A) for
B) while
C) do-while
D) enhanced-for
Answer: C

44. Which of the following is not possible in method overloading?

A) Changing return type
B) Changing parameter order
C) Changing number of parameters
D) Using different parameter types
Answer: A

45. Which of the following class types in Java cannot be instantiated?

A) Interface
B) Abstract class
C) Enum
D) Both A and B
Answer: D

46. Which is not a valid access modifier in Java?

A) private
B) protected
C) public
D) internal
Answer: D

47. What will be the output of System.out.println(“10” + 20 + 30);?

A) 60
B) 102030
C) 1030
D) 102030.0
Answer: B

48. What is the purpose of the finalize() method in Java?

A) To start garbage collection
B) To stop a thread
C) To clean up before garbage collection
D) To make a class final
Answer: C

49. Which of these is a thread-safe class?

A) HashMap
B) ArrayList
C) Hashtable
D) StringBuilder
Answer: C

50. Which of the following is used to create a custom exception in Java?

A) Extending the RuntimeException class
B) Extending the Error class
C) Implementing the ExceptionHandler interface
D) Overriding the catch block
Answer: A

51. What will be the output of System.out.println(10 + 20 + “Java” + 10 + 20);?

A) 30Java30
B) 30Java1020
C) Java1020
D) Compilation Error
Answer: B

52. What is the correct syntax for a lambda expression that takes no arguments and prints “Hello”?

A) ()->System.out.println(“Hello”)
B) (System.out.println(“Hello”))->
C) print(“Hello”)=>{}
D) ()=>print(“Hello”)
Answer: A

53. What does the synchronized keyword do in Java?

A) Locks code to prevent concurrent access
B) Stops the program
C) Deletes temporary variables
D) Converts methods to static
Answer: A

54. Which of the following interfaces is a functional interface?

A) Runnable
B) Comparable
C) Comparator
D) All of the above
Answer: D

55. What is the default thread priority in Java?

A) 1
B) 5
C) 7
D) 10
Answer: B

56. Which of the following are unchecked exceptions?

A) NullPointerException
B) ArithmeticException
C) ArrayIndexOutOfBoundsException
D) All of the above
Answer: D

57. Which of these keywords is used to implement multiple inheritance in Java?

A) class
B) implements
C) interface
D) extends
Answer: B

58. What is the output of System.out.println(2 + 3 * 4);?

A) 20
B) 14
C) 24
D) 18
Answer: B

59. Which collection class stores elements in insertion order and is synchronized?

A) LinkedList
B) ArrayList
C) Vector
D) LinkedHashSet
Answer: C

60. Which Java Stream operation is intermediate?

A) collect()
B) forEach()
C) filter()
D) count()
Answer: C

61. Which of these is not a valid keyword in Java?

A) volatile
B) transient
C) const
D) strictfp
Answer: C) const

62. What is the purpose of the transient keyword in Java?

A) Marks a variable as constant
B) Excludes a variable from serialization
C) Makes a variable thread-safe
D) Allows variable inheritance
Answer: B) Excludes a variable from serialization

63. Which method in the Object class is used to create a shallow copy of an object?

A) clone()
B) copy()
C) replicate()
D) duplicate()
Answer: A) clone()

64. What does the keyword volatile indicate in Java?

A) A variable cannot be serialized
B) Variable is cached locally
C) Variable is stored in main memory and is thread-safe for visibility
D) Variable cannot be changed
Answer: C) Variable is stored in main memory and is thread-safe for visibility

65. Which of these is not part of Java Memory Areas?

A) Heap
B) Stack
C) PermGen
D) Kernel Memory
Answer: D) Kernel Memory

66. Which of these streams is used for reading binary data?

A) FileReader
B) BufferedReader
C) FileInputStream
D) Scanner
Answer: C) FileInputStream

67. Which class in Java is immutable?

A) String
B) StringBuffer
C) StringBuilder
D) CharArray
Answer: A) String

68. What does the join() method in the Thread class do?

A) Starts multiple threads simultaneously
B) Waits for a thread to finish execution
C) Merges two threads into one
D) Synchronizes two threads
Answer: B) Waits for a thread to finish execution

69. Which annotation is used to mark a method that should run after all tests in a JUnit class?

A) @Before
B) @After
C) @BeforeClass
D) @AfterClass
Answer: D) @AfterClass

70. Which of these is true about Java’s garbage collector?

A) Runs at a fixed time interval
B) Can be manually forced but not guaranteed
C) Deletes objects immediately when they become unreachable
D) Needs to be started explicitly by the developer
Answer: B) Can be manually forced but not guaranteed