Menu
Question Index
...

What will be the output of the program?

public class Statement {
    public static void main(String[] String) {
        if ("String ".trim() == "String") {
            System.out.print("true1 ");
        }
        if (" String ".trim() == "String") {
            System.out.print("true2 ");
        }
        if ("String".trim() == "String") {
            System.out.print("true3 ");
        }
        if ("Str ing ".trim() == "String") {
            System.out.print("true4");
        }
    }
}


true1 true2 true3 true4
true1 true2 true4
true1 true2
true1
true3
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java String trim() Method - trim() Method In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App