Java Programming - MCQ Practice Questions
Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.
958 questions | 100% Free
What will be the output: System.out.println('A' + 'B');
What is the output of: int x = 5; System.out.println(++x + x++);
Which of the following correctly represents a long literal in Java?
What will be printed? float f = 5.5f; System.out.println(f);
What is the result of: System.out.println(true && false || true);
Which of the following statements will compile successfully?
What is the output of: System.out.println(10 * * 2);
Which of the following is the correct syntax for a multi-line comment in Java?
What will be the output: String s = "Hello"; System.out.println(s.charAt(1));
What is the output of: System.out.println("5" + 3 + 2);
Which of the following correctly initializes a 2D array in Java?
What will be the output: int a = 10; int b = 20; System.out.println(a > b ? "A" : "B");
What is the output of: double d = 5.7; int i = (int) d; System.out.println(i);
Which statement about Java's 'this' keyword is correct?
What will be the output of: System.out.println(Math.max(5, 10) - Math.min(3, 8));
Which of the following is NOT a valid Java identifier?
Which keyword is used to prevent method overriding in Java?
Which of the following statements about Java packages is correct?
What is the difference between == and .equals() for String comparison?
Which access modifier allows access within the same package and subclasses?