Question: The code below shows some of the text for a class called City. Now write a complete public constructor, which takes a String parameter called
The code below shows some of the text for a class called City. Now write a complete public constructor, which takes a String parameter called cityName. Your code should initialize the name attribute of the City class to the value of cityName. It should initialize the population attribute to a value of -1. (Presumably the class has a setPopulation method that will be used to set the city's population after the object has been constructed).
public class City { private String name; private int population;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
