MCQs > IT & Programming > Java > Output if myMethod() is executed? class MyPoint { void myMethod() { int x, y; x = 5; y = 3; System.out.print( ' ( ' + x + ', ' + y + ' )' ); switchCoords( x, y ); System.out.print( ' ( ' + x + ', ' + y + ' )' ); } void switchCoords( int x, int y ) { int temp; temp = x; x = y; y = temp; System.out.print( ' ( ' + x + ', ' + y + ' )' ); } }

Java MCQs

What is printed to the standard output if myMethod() is executed?

class MyPoint { 
  void myMethod() { 
     int x, y;
     x = 5; y = 3;
     System.out.print( " ( " + x + ", " + y + " ) " );
     switchCoords( x, y );
     System.out.print( " ( " + x + ", " + y + " ) " );
  }
  void switchCoords( int x, int y ) { 
     int temp;
     temp = x;
     x = y;
     y = temp;
     System.out.print( " ( " + x + ", " + y + " ) " );
  }
}

Answer

Correct Answer: (5, 3) (3, 5) (5, 3)

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Java Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it