Menu
Question Index
...

What will be the output of the following program?

public class UnitedStatesOfAmerica {
    public static void main(String[] args) {
        String s = "UnitedStatesOfAmerica";
        for (int i = 0; i < s.length(); i++) {
            if (i % 3 == 0) continue;
            if (i == 12) break;
            if (i == 9) return;
            System.out.print(s.charAt(i));
        }
    }
}


niedta
niedtaes
UnitedStatesOfAmerica
Some other output or Compilation Error

Doubts

Problems

Topic: charAt() Method In Java - Java Character Extraction

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App