What will be the output of the following program?class string_demo {public static void main(String args[]){String obj = "I" + "like" + "Java"; System.out.println(obj); }}Select one:likeIIlikeJavaJava
Question
What will be the output of the following program?class string_demo {public static void main(String args[]){String obj = "I" + "like" + "Java"; System.out.println(obj); }}Select one:likeIIlikeJavaJava
Solution
The output of the program will be "IlikeJava". This is because the "+" operator is used to concatenate the strings "I", "like", and "Java" together without any spaces in between.
Similar Questions
Select the correct answerWhat will be the output of the following Java program? class string_demo { public static void main(String args[]) { String obj = "I" + "like" + "CodeTantra"; System.out.println(obj); } }OptionsjavaCodeIIlikeCodeTantra
What is the output of this program? String obj = "I LIKE JAVA"; System.out.println(obj.charAt(3));Select one:KILE
What will be the output of the following program?class string_class {public static void main(String args[]){String obj = "hello";String obj1 = "world"; String obj2 = obj;obj2 = " world";System.out.println(obj + " " + obj2); }}
What will be the output of the following Java program? class mainclass { public static void main(String args[]) { char a = 'Z'; a++; System.out.print((int)a); } }Options9091122123
What will be the output of the following Java program?class mainclass { public static void main(String args[]) { boolean ct1 = true; boolean ct2 = false; if (ct1) System.out.println(ct1); else System.out.println(ct2); } }Options10truefalse
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.