Menu
Question Index
...

What will be the output of the following program?

public class Glass {
    public static void main(String[] args) {
        new Glass().went("welcome to merit campus", 1);
        new Glass().go("hi", "how are you", 2, 3);
    }
    public void go(String string, String string1, int x) {
        System.out.print((string + string1).length() - 1 + x + " ");
    }
    public void went(String str, int y) {
        System.out.print(str.length() + ",");
    }
}


22,11
24,13
18,6
Some other output
Compilation Error or Runtime Error.

Doubts

Problems

Topic: Java length() Method | length() Method In Java - Strings

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App