Anzeige
Please only answer if you can answer all questions correctly- Some cho.docx
Please only answer if you can answer all questions correctly- Some cho.docx
Please only answer if you can answer all questions correctly- Some cho.docx
Nächste SlideShare
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
Wird geladen in ... 3
1 von 3
Anzeige

Más contenido relacionado

Más de rtodd19(20)

Anzeige

Please only answer if you can answer all questions correctly- Some cho.docx

  1. Please only answer if you can answer all questions correctly. Some choices have been eliminated, because they have been verified as being wrong. Please explain your answers. 13. Insert the missing code in the following code fragment. This fragment is intended to implement a method to assign a value to an instance variable. Select one: a. public void setModel(String modelName) d. public String setModel(String modelName) 14. Consider the following code snippet: Which statement reflects the action performed when the constructor to Coin is called? Select one: b. The variable coinName will be initialized to "null" and the variable coinValue will be initialized to 0. d. The variable coinName will be initialized to null and the variable coinValue will be initialized to 0. 19. Which operator should you use to test whether an object reference is null? Select one: a. == c. <= 22. Insert the missing code in the following code fragment. This fragment is intended to implement a method to set the value stored in an instance variable. Select one: b. public void getHourly()
  2. d. public boolean setHourly(boolean isHourly) Solution 13) Ans- a. public void setModel(String modelName) The solution lies in providing public methods through which new values can be assigned to these variables and the values they hold can be accessed. These are commonly known as get and set methods. Get methods provide access to the value a variable holds while set methods assign values to the variables of the objects. First, we shall see how we write a method. In order to set a variable to a new value,. These required arguments are specified in the method header within the parentheses by specifying the variable name and a data type for that variable name. public void setModel(String modelName) { The solution lies in providing public methods through which new values can be assigned to these variables and the values they hold can be accessed. These are commonly known as get and set methods. Get methods provide access to the value a variable holds while set methods assign values to the variables of the objects. First, we shall see how we write a method. In order to set a variable to a new value,. These required arguments are specified in the method header within the parentheses by specifying the variable name and a data type for that variable name.
Anzeige