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 String myName; public String myName; private myName; private String myName;

Answers

Answer 1
Question:

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.


Related Questions

what are the different steps while solving a problem using computer? explain​

Answers

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.

Other Questions
Work out the lengths of sides a and b.Give your answers to 1 decimal place.17 cmaab8 cm12 cm5 cm There is a bag with only red marbles and blue marbles.The probability of randomly choosing a blue marble is 78.There are 56 marbles in total in the bag and each is equally likely to be chosen.Work out how many red marbles there must be. Calculate the amount of heat required to completely sublime 55.0 g of solid dry ice CO2 at its sublimation temperature. The heat of sublimation for carbon dioxide is 32.3 kj mol The value of H for the reaction below is -6535 kJ. ________ kJ of heat are released in the combustion of 16.0 g of C6H6 (l)?2C6H6 (l) + 15O2 (g) 12CO2 (g) + 6H2O (l) Write the electron configuration for Gold (Au). You may choose to write it in the long form or in the noble gas configuration form (shortcut). what is the mean mark of 847 30? helpppppppppppppppppppppppppppppppppp!!!!!!!!! Alpha wolves track the prey.The prey is also hunted by alpha wolves.Alpha wolves decide where to build the pack's den.Producing pups for the pack is also something alpha wolves do.Directions Combine the sentences into one sentence that includes a list. You may change the form of the action words and remove unnecessary words. A flywheel in a motor is spinning at 510 rpm when a power failure suddenly occurs. The flywheel has mass 40.0 kg and diameter 75.0 cm . The power is off for 40.0 s , and during this time the flywheel slows down uniformly due to friction in its axle bearings. During the time the power is off, the flywheel makes 210 complete revolutionsAt what rate is the flywheel spinning when the power comes back on(in rpm) Part AWhose scatter plot matches the data, and what is wrong with the incorrect scatter plot? Why did Lord John want to capture a Pterodactyl to take back to England? Shape a and shape b are each made from four identical sqaures the perimeter of shape a is 56 cm work out shape b can the angles with measures 80o , 55o and 65o form angles on a line Which passage most clearly contains imagery?O A. "Don't say another word!" Gina shouted.B. The odor of rotten eggs wafted from within.C. He suspected. He knew. He saw. He smiled.D. First, call our hotline. Next, work out a plan.SUBM help please! the question is in the picture below for reference when answering! thank you so much! ? On a number line, graph all the temperature that are warmer than -2 degrees Celsius What is the median of this set of data? 362, 187, 211, 298, 331, 250, 347, 199 help me ls 20 points !!! i will mark brainliest just someone help me quick How many inches are there in 3 yards? A. 108 in. B. 96 in. C. 72 in. D. 48 in.