Java Programming
Java OOP, collections, multithreading
212 Questions 10 Topics Take Test
Advertisement
Showing 211–212 of 212 questions
Q.211 Hard Basics & Syntax
What will be printed? System.out.println(10 + 20 + "Java");
A 30Java
B 10 + 20 + Java
C 1020Java
D Compilation error
Correct Answer:  A. 30Java
EXPLANATION

String concatenation works left to right. 10 + 20 = 30 (integer addition), then 30 + "Java" = "30Java" (string concatenation).

Take Test
Q.212 Hard Basics & Syntax
Consider the code: int a = 5; int b = a++; System.out.println(a + " " + b); What is the output?
A 5 5
B 6 5
C 5 6
D 6 6
Correct Answer:  B. 6 5
EXPLANATION

The post-increment operator (a++) returns the value before incrementing. So b = 5, then a becomes 6. Output: 6 5

Take Test
IGET
iget AI
Online · Ask anything about exams
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips