Question: Write two versions of the following class: The first version is a regular class where the class name is Data. The class have one

Write two versions of the following class: The first version is a

Write two versions of the following class: The first version is a regular class where the class name is Data. The class have one instance variable called msg of type string, and one static/class variable called calls of type int. Both of those variables are private. This class has only one constructor that take one parameter of type string. This parameter will be calls to be assigned to msg. The constructor increase calls variable by 1. There are two other methods in this class; one called getData which returns the value of the msg, and the other method is getCount which returns the value of the calls variable. The second version of this class should be generic parameterized class in which other data can be stored, not only strings!

Step by Step Solution

3.27 Rating (142 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Regular Class java public class Data private String msg private static int calls ... View full answer

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 Programming Questions!