Which XXX declares a student's name.
public class Student {
XXX
private double myGPA;
private int myID;
public int getID() {
return myID;
}
}
Group of answer choices
a. String myName;
b. public String myName;
c. private myName;
d. private String myName;
Answer:private String myName;
Explanation:To declare a student's name, the following should be noted.
i. The name of the student is of type String
ii. Since all of the instance variables (myGPA and myID) have a private access modifier, then myName (which is the variable name used to declare the student's name) should be no exception. In other words, the student's name should also have a private access.
Therefore, XXX which declares a student's name should be written as
private String myName;
Option (a) would have been a correct option if it had the private keyword
Option (b) is not the correct option because it has a public access rather than a private access.
Option (c) is not a valid syntax since, although it has a private access, the data type of the variable myName is not specified.
Option (d) is the correct option.
what are the different steps while solving a problem using computer? explain
Explanation:
The following six steps must be followed to solve a problem using computer.
Problem Analysis.
Program Design - Algorithm, Flowchart and Pseudocode.
Coding.
Compilation and Execution.
Debugging and Testing.
Program Documentation.