Question & Answer: 11. Setters are void return type methods O True O False 12. To make fields directly accessible to other classes, the class fields must be…..

11. Setters are void return type methods O True O False 12. To make fields directly accessible to other classes, the class fields must be marked public. O True O False 13. Static variables of a class can be accessed, even if the class has not been instantiated O True O False 14. Given the following code, why does your IDE complain that non-static variable name cannot be referenced from a static context? public class Employee( public static int employeeD public String name; public static void display(H System.out.printin(employeeID); System.out.printin(name); OIt would be possible to call the display) method and attempt to reference an objects name before any object exists. O The variable name has a null value O Static variables are only accessible from instance methods. O Static variables cannot be referenced from methods 15. Objects are accessed using reference variables. O True O False

Question & Answer: 11. Setters are void return type methods O True O False 12. To make fields directly accessible to other classes, the class fields must be..... 1

Question & Answer: 11. Setters are void return type methods O True O False 12. To make fields directly accessible to other classes, the class fields must be..... 2

11. Setters are void return type methods O True O False 12. To make fields directly accessible to other classes, the class fields must be marked public. O True O False 13. Static variables of a class can be accessed, even if the class has not been instantiated O True O False 14. Given the following code, why does your IDE complain that “non-static variable name cannot be referenced from a static context”? public class Employee( public static int employeeD public String name; public static void display(H System.out.printin(employeeID); System.out.printin(name); OIt would be possible to call the display) method and attempt to reference an object’s name before any object exists. O The variable name has a null value O Static variables are only accessible from instance methods. O Static variables cannot be referenced from methods 15. Objects are accessed using reference variables. O True O False

Expert Answer

 

11.) True

The setter functions are always void because in this functions we have to set the values

12.) True

The public access modifier will help in making those fields visible to other classes in the same package.

13.) True

The static variables can be accessed with the help of the class name.

14.) Option a

In the given program the static variable is not been referenced to a static context.

15.) True

Objects are been referenced as Object muObj = new Object;

16.) Each new instance of the object will have different location

   All objects are equal

17.) Student

It is a reference variable and is pointing out to the Student class. Hence, it is a student varaible.

18.) True

The default constructor is not written by the compiler but provided by the complier which states that the no-argument method is there but as soon as you explicitly define an constructor it is gone.

19.) b & c

They both are correct as the name and the salary are the instance variables and hence, this keyword will provide the recent instance of the class which will provide with the value of the name and salary.

20.) True

The fields are initialized without any value than they will take the default values so that no error occurs during the compilation process and the operations of the given fields are operated with the default values.

Still stressed from student homework?
Get quality assistance from academic writers!