Monday 23 March 2020

PRINTING NUMBERS AND LETTERS USING JAVA LANGUAGE

Q-9- What do each of the following print?
        a.System.out.println(2 + "bc");
        b.System.out.println(2 + 3 + "bc");
        c.System.out.println((2+3) + "bc");
        d.System.out.println("bc" + (2+3));
        e.System.out.println("bc" + 2 + 3);

INPUT :
public class NCM {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(2+"bc");
System.out.println(2+3+"bc");
System.out.println((2+3)+"bc");
System.out.println("bc"+(2+3));
System.out.println("bc"+2+3);
}


}

OUTPUT :
2bc
5bc
5bc
bc5

bc23

No comments:

Post a Comment