Question: in java code public class School 5. Here is the code for a very basic class to private String schoolname; create a School object. Comments
in java code
public class School 5. Here is the code for a very basic class to private String schoolname; create a School object. Comments are private int studentCount; omitted to save space. There are two fields and one method in addition to the public School(String name){ constructor. this.name = name; } public void setStudentCount(int students) { studentCount = students; } } We will now create a Neighborhood class which will contain a School object. Which of these method calls will successfully instantiate the School object: Indicate yes or no a. school1 = new School b. school2 = new School("RCC") c. school3 = new School(3) d. school4 = new School(RCC) e schools = new School("RCC", "Suffern") 6. Why is it best to use methods that already exist in the object's class rather than write new methods in the class where the object is a field? 7. Write a method for the Neighborhood class that will assign the number of students to the school
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
