Home / MCQ Bank / Computer
Computer Flow Control

What will be the output of the following Java code? class access { public int x; private int y; void cal(int a, int b) { x = a + 1; y = b; } } public class access_specifier { public static void main(String args[]) { access obj = new access(); obj.cal(2, 3); System.out.println(obj.x + " " + obj.y); } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • Runtime Error

Related Computer Questions

Which one of the following is not attributes of file? Which of the following is used to display the content of a certain drive or folder? What is the output of the following code: x = 0 while x < 5: print(x) x += 1 What will be the chromatic number for an empty graph having n vertices? What is the meaning of "SELECT" clause in Mysql?