Question: Programming Language is in Java Create a class called Baron, which will construct objects which have a name as its instance variable. There must be

Programming Language is in Java

Create a class called Baron, which will construct objects which have a name as its instance variable. There must be a constructor for 0 and 1 parameter. There must be accessor and mutator methods for the instance variable where the method is named getName or setName. Lastly, there must be a method called compare, that takes a SINGLE Classy object as a parameter and compares the name of both objects and RETURNS A STRING of an appropriate message if it has the same name as the other object, or an appropriate message if it does not have the same name as the other object. You will have a main method within this class, where you will use each constructor you created to create two Barons, b1 and b2. You will then include the following code: System.out.println(b1.compare(b2)); b1.setName(new String(" [ENTER THE SAME NAME AS B2 HERE] "); //if you copy and paste this, the quotations may need to be replaced in the IDE System.out.println(b1.compare(b2));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!