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
Which of the following is NOT a primitive data type in Java?
What is the size of 'char' data type in Java?
Which of the following will compile without error? public static void main(String args[]) { int x = 10; final int y = 20; y = 30; }
What is the output of: System.out.println();
Which operator has the highest precedence in Java?
What is the output of: System.out.println(5 > 3 ? 'A' : 'B');
Which statement is correct about Java variables?
Identify the output: System.out.println("Java".length());
Which of the following is the correct way to declare and initialize an array in Java?
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 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);
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?