Question: Write a class with the following static methods: WORDCOUNT. This method should accept a reference to a String object as an argument and return the

Write a class with the following static methods: WORDCOUNT.

This method should accept a reference to a String object as an argument and return the number of words contained in the object. ARRAYTOSTRING. This method accepts a char array as an argument and converts it to a String object. The method should return a reference to the String object. MOSTFREQUENT. This method accepts a reference to a String object as an argument and returns the character that occurs the most frequently in the object. REPLACESUBSTRING. This method accepts three references to String objects as arguments. Lets call them string1, string2, and string3. It searches string1 for all occurrences of string2. When it finds an occurrence of string2, it replaces it with string3. For example, suppose the three arguments have the following values: string1: the dog jumped over the fence string2: the string3: that With these three arguments, the method would return a reference to a String object with the value that dog jumped over that fence.

Demonstrate each of these methods in a complete program. You will need to submit 2 .java files named something like: MyUtil.java testMyUtil.java

As a reminder the "main" method should exist in the test class which is where you are calling each of the required static methods listed above.

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!