Given The Declaration Public Class Myclass Private Int X Public Void Print Syste

Given the declaration

public class MyClass{    private int x;    public void print()    {        System.out.println(“x = ” + x);    }    private void setX(int y)    {        x = y;    }}MyClass myObject = new MyClass();The following statement is legal.

myObject.setX(10);

A) True

B) False

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply