What Will Be The Output Of The Following Java Programp Pre #1066

What will be the output of the following Java program?</p> <pre><code class="language-java" line="1"> package pkg; class display { int x; void show() { if (x > 1) System.out.print(x + " "); } } class packages { public static void main(String args[]) { display[] arr=new display[3]; for(int i=0;i<3;i++) arr[i]=new display(); arr[0].x = 0; arr[1].x = 1; arr[2].x = 2; for (int i = 0; i < 3; ++i) arr[i].show(); } }</code></pre> <p>Note : packages.class file is in directory pkg;

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs128 Java. It can also be found in gs gs128 Java Interfaces Packages - Java Packages - Quiz No.1.


Similar question(s) are as followings:



Online Quizzes of gs128 Java

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background