Question: Create a java class whose object represents a holiday during the year. This class has three instance variables: name, which is a String representing the
Create a java class whose object represents a holiday during the year. This class has three instance variables: name, which is a String representing the name of the holiday day, which is an int representing the day of the month of the holiday month, which is a String representing the month the holiday is in. a) Write a constructor for the class, which takes a String representing the name, an int representing the day, and a String representing the month as its arguments, and sets the instance variables to these values. b) Write a method which compares two instances of the class and returns the Boolean value true if they have the same month, and false if they do not. c) Write a piece of code that creates an instance with the name Independence Day, with the day 4, and with the month July.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
