Knowee
Questions
Features
Study Tools

elect the correct answerWhat will be the output of the following Java code?class array_output {  public static void main(String args[])   {    char array_variable [] = new char[10]; for (int i = 0; i < 3; ++i)     {      array_variable[i] = 'R';      System.out.print(array_variable[i] + "");    }  } }OptionsPQR0 1 2 3 4 51 2 3 4 5 6 7 8 9 10RRR

Question

elect the correct answerWhat will be the output of the following Java code?class array_output {  public static void main(String args[])   {    char array_variable [] = new char[10]; for (int i = 0; i < 3; ++i)     {      array_variable[i] = 'R';      System.out.print(array_variable[i] + "");    }  } }OptionsPQR0 1 2 3 4 51 2 3 4 5 6 7 8 9 10RRR

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

Solution

The output of the given Java code will be "RRR". This is because the for loop runs three times, and each time it assigns the character 'R' to the array_variable at index i and then prints it.

Similar Questions

answerWhat will be the output of the following Java program? class array_value { public static void main(String args[]) { int array_variable [] = new int[20]; for (int v = 10; v < 20; ++v) { array_variable[v] = v/2; array_variable[v]++; System.out.print(array_variable[v] + " "); v++; }  } }Options10 12 14 16 1810 11 12 13 14 15 16 17 18 196 7 8 9 1010 11 12 13 14 15 16 17 18 19 20

What will be the output of the following Java program? class array_output { public static void main(String args[]) { char array_variable [] = new char[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = 'C'; System.out.print(array_variable[i] + "" ); i++; } } }OptionsCCCCCCCCCCCCCCCC D E F GNone of the mentioned

What is the output of the following code?public class array_output { public static void main(String args[]) { int array_variable[] = new int[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = i; System.out.print(array_variable[i] + " "); i++; } }}Options: Pick one correct answer from below0 2 4 6 81 3 5 7 90 1 2 3 4 5 6 7 8 91 2 3 4 5 6 7 8 9 10

Determine the outputclass array_output {                 public static void main(String args[])                 {                                 char array_variable [] = new char[10];                                 for (int i = 0; i < 10; ++i)                                 {                                                 array_variable[i] = 'i';                                                  System.out.print(array_variable[i] + "");                                }                } } Select one:a.i j k l m n o p q rb.0 1 2 3 4 5 6 7 8 9 10c.1 2 3 4 5 6 7 8 9 10d.i i i i i i i i i i

What will be the output of the following Java program?class output_odd   {    public static void main(String args[])     {            int p = 2;       int q = 0;       for ( ; q < 8; ++q)        {         if (q % p == 0)            continue;           else if (q == 6)           break;         else          System.out.print(q + " ");       }    }   }Options2 4 6 81 3 5 7 91 3 5 71 2 3 4 5 6 7 8 9

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.