What is the output of this program? String obj = "I LIKE JAVA"; System.out.println(obj.charAt(3));Select one:KILE
Question
What is the output of this program? String obj = "I LIKE JAVA"; System.out.println(obj.charAt(3));Select one:KILE
Solution
The output of this program will be a single character 'I'. The charAt() method in Java returns the character at the specified index. Indexes in Java start from 0, so the character at index 3 in the string "I LIKE JAVA" is 'I'.
Similar Questions
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
What is the output of the following Java program?
What is the output of the following code snippet? String str1 = "Java"; String str2 = new String("Java"); System.out.println(str1 == str2);
What will be the output of the following Java program? package pkg; class output {public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Hello"); s1.setCharAt(1, x); System.out.println(s1); } }
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
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.