1. Use the following declarations to create a new string variable that contains the phrase “going to Win” and print to the screen.

String word = “Washington”;

2. Using the original string value forwordcreate a new string namedbackwardsthat contains the reverse of the original string inwordand print to the screen.

3. Given the following declarations : String phrase = ” WazzUp ? – Who’s On FIRST ??? – IDUNNO”; Write the necessary code to count the number of vowels in the string andprint appropriate message to the screen.

4. Search the string “George Washington” for the substrings “ton” and “Wish”. Printan appropriate message to the screen.

5. Given the following assignment to word

String word = “We the people of the United States in order to form a more perfect union”

Write a methodthat will find and print the last word in the string.

Source link

Leave a Reply

Your email address will not be published.