Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedin 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions