Question: Draw the UML class diagram only related to the code below and write an overloading constructor, which accepts two arguments for setting the corresponding fields.
Draw the UML class diagram only related to the code below and write an overloading constructor, which accepts two arguments for setting the corresponding fields. The body of this constructor first properly calls another constructor, and then sets another field without using assignment operator. This constructor is for internal usage, within the class itself.
public class City {
protected String cName;
private int cArea;
public City(String cName) {}
void setC (String n) {cName = n;}
void setC (int a) { cArea = a; }
public int getA () { return cArea; }
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
