🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Strings Quiz: all 8 questions

Strings Quiz · Question 4 of 8

What does this print? (code)

What does this print?

System.out.println('c' - 'a');
Answer & explanation

Correct answer: 2

Characters are numbers: 'c' (99) − 'a' (97) = 2. This is how letters map to indexes 0–25.

Can you get the rest right without peeking?

Take the timed Strings Quiz quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →