Knowee
Questions
Features
Study Tools

Select the correct answerWhat will be the output of the following Java program?class String_demo {  public static void main(String args[])  {    char chars[] = {'f', 'o', 'r'};    String s = new String(chars);    System.out.println(s);  }}Optionsfrforo

Question

Select the correct answerWhat will be the output of the following Java program?class String_demo {  public static void main(String args[])  {    char chars[] = {'f', 'o', 'r'};    String s = new String(chars);    System.out.println(s);  }}Optionsfrforo

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct answer is "for". The program creates a new string from the array of characters {'f', 'o', 'r'}, and then prints this string.

Similar Questions

the correct answerWhat 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); } }Options9112290123

Select the correct answerWhat will be the output of the following Java code? class codetantra  {    public static void main(String args[])     {      char a = 'A';      char b = 76;      b++;      a++;      System.out.println(a + " " + b);    }   }OptionsC NB MD OA M

Consider the given code: class String_demo { public static void main(String args[]) { char arr[] = {'Q','W','E','R','T','Y}; } }Which among the following option will print QWERTYA) System.out.println(arr);B) System.out.println(arr.toString());C) new String(arr); System.out.println(str);D) System.out.println(Arrays.toString(arr));

What will be the output of the following Java program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 1, 4); int i; int j; try { while((i = input1.read()) == (j = input2.read())) { System.out.print((char)i); } } catch (IOException e) { e.printStackTrace(); } } }A) abcB) abcdC) abcdeD) none of the mentioned

What will be the output of the below program?public class Test {                               public static void main(String[] args) {                                    char c = 65;                                    System.out.println("c = " + c);                               }} Note : explain clearly in the answer

1/3

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.