<< Chapter < Page | Chapter >> Page > |
What output is produced by the program shown in Listing 5 ?
Listing 5 . Listing for Question 5. |
---|
public class Ap029{
public static void main(String args[]){new Worker().doRelat();
}//end main()}//end class definition
class Worker{public void doRelat(){
Dummy x = new Dummy();Dummy y = new Dummy();
System.out.println(x>y);
}//end doRelat()}//end class definition
class Dummy{int x = 5;
double y = 5.5;String z = "A String Object";
}//end class Dummy |
What output is produced by the program shown in Listing 6 ?
Listing 6 . Listing for Question 6. |
---|
public class Ap030{
public static void main(String args[]){new Worker().doIncr();
}//end main()}//end class definition
class Worker{public void doIncr(){
int w = 5, x = 5;double y = 8.3, z = 8.3;
w++;x--;
y++;z--;
System.out.println(w + " " +x + " " +
y + " " +z);
}//end doIncr()}//end class definition |
What output is produced by the program shown in Listing 7 ?
Listing 7 . Listing for Question 7. |
---|
public class Ap031{
public static void main(String args[]){new Worker().doIf();
}//end main()}//end class definition
class Worker{
public void doIf(){int x = 5, y = 6;
if(x - y){System.out.println("Hello");
}//end if}//end doIf()
}//end class definition |
What output is produced by the program shown in Listing 8 ?
Listing 8 . Listing for Question 8. |
---|
public class Ap032{
public static void main(String args[]){new Worker().doIf();
}//end main()}//end class definition
class Worker{public void doIf(){
int x = 5, y = 6;if(x<y){
System.out.print("Hello ");}//end if
System.out.println("World");}//end doIf()
}//end class definition |
What output is produced by the program shown in Listing 9 ?
Listing 9 . Listing for Question 9. |
---|
public class Ap033{
public static void main(String args[]){new Worker().doIf();
}//end main()}//end class definition
class Worker{public void doIf(){
int x = 5, y = 6;if(x == y){
System.out.println("Hello World");
}else{System.out.println(
"Goodbye World");}//end else
}//end doIf()}//end class definition |
What output is produced by the program shown in Listing 10 ?
Listing 10 . Listing for Question 10. |
---|
public class Ap034{
public static void main(String args[]){new Worker().doIf();
}//end main()}//end class definition
class Worker{public void doIf(){
int x = 2;if(x == 4){
System.out.println("x = 4");}else if (x == 5){
System.out.println("x = 5");}else if (x == 6){
System.out.println("x = 6");}else{
System.out.println("x != 4,5,6");}//end else
}//end doIf()}//end class definition |
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?