/** * A class to practice calling methods that return a value, e.g. String * class methods replace() and length(), and String concatenation and * assignment statements * * For reference, consult online notes and class MethodCalls.java */ public class MethodCaller1 { public static void main(String[] args) { // Exercise 1 - create a String objcct called state with contents of // "Mississippi" and print it // Exercise 2 - create a new String object with a name of your own // choosing and store a modified version of state in it, with all // occurrences of "s" changed to "$". Print both the original and // modified Strings, properly labelled. // Exercise 3 - for the two String objects declared below, use assignment // statements to store your first and last names. Do not modify the // String declarations - use assignments statements. Then concatenate // them with a space in between and print a message such as this: // Hello, John Dough. Your name has 10 characters! // using your own name and calling the length() method. String first ; String last ; // Exercise 4 (time permitting) - in the new String object you created // in Exercise 2, remove all occurrences of "i" by replacing each with // the "empty" String (aka: the null String). The null String contains 0 // characters and looks like this: "". Then print it. } // end of main method } // end of MethodCaller1 class