Question: JAVA PROGRAMMING You will create a Java program that will consist of two public classes. One public class will be the AnyString class. This class
JAVA PROGRAMMING
- You will create a Java program that will consist of two public classes. One public class will be the AnyString class. This class will contain data and code to manipulate the data. The second public class will be the TestAnyStringClass. This class will create objects of the AnyString class and test its methods.
- The AnyString class should contain the following:
- An single object/instance variable of type String.
- A constructor method that will accept a single String value and uses it to set the object/instance variable.
- An object/instance method getString() that accepts no argument and returns the object/instance variable value.
- An object/instance method lowercase() that accepts no arguments and returns a String value. The method will return the lowercase value of the object/instance variable.
- An object/instance method uppercase() that accepts no arguments and returns the uppercase value of the object/instance variable.
- An object/instance method getLength() that accepts no arguments and returns the length of the object/instance variable.
- The TestAnyStringClass should contain the following:
- You should input a string.
- Create an object of the AnyString class.
- Call all the methods in the AnyString class, verify that they work, and display the results.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
