Introduction to Java using NetBeans
Section 2 - Using String Data
A string is any group of characters that is enclosed in quotes.
Every character in a string has an index position in the string (an integer). The index position of the first character is 0.
Below are lines of code that make use of string methods. Try to figure out what each line of code will print and then check your answers by typing up the code.
Check Your Understanding
Assignment 2.8 String Manipulation
Create an application that asks the user for their first name and their last name and stores them in a single string.
is your Name?
Display the name using the formats:
1. "Your name
in reverse order is Lastname, Firstname " in an appropriate
" in an appropriate message box
HINT: Find the position of the space and then use substring
2. Display the number of characters in the name, firstname, and lastname, not including spaces.
" There are 17 characters in your fullname"
" There are 9 characters in your firstname"
" There are 8 characters in your lastname"
3. Regardless of how the name is entered (upper, lower, combination) display the names with upper case first letters and lower case everything else.
5. Make everything work if First Middle Last names are entered.
3. Display the entire name in Upper Case Letters
4. Display the entire name in Lower Case Letters
Posting your work
1. Upload the Java Projects to your Gravelle Folder (Share with me only) and put a link for each assignment on your website.
JAR files which are executable java files do not work on projects without a display so we will not use them in this assignment.