Menu
Question Index
...

What will be the output of the following program?

public class PrintStatementsOutput
{
    public static void main(String[] args)
    {
        String str = "Hai friend how are you";

        System.out.print(str);
        System.out.println();
        System.out.printf(str, str);
        System.out.println();
        System.out.format(str, str, str);
    }
}


Hai friend how are you
Hai friend how are youHai friend how are you
Hai friend how are youHai friend how are youHai friend how are you
Hai friend how are you
Hai friend how are you
Hai friend how are you
Hai friend how are you
Hai friend how are you
Hai friend how are you
Hai friend how are you Hai friend how are you Hai friend how are you
Compilation Error
Runtime Error

Doubts

Problems

Topic: Formatting Strings And Characters By Using Formatter

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App