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

Quiz: Java Strings · Question 2 of 10

What does this print? (code)

What does this print?

public class Main {
    public static void main(String[] args) {
        System.out.println("Placement".substring(2, 5));
    }
}
  1. A.lac
  2. B.ace
  3. C.acem
  4. D.Pla
Answer & explanation

Correct answer: ace

Indexes 2, 3, 4 of "Placement" are a, c, e.

Can you get the rest right without peeking?

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

Start the quiz →