And your teacher is trying to tell you that the String's length method will tell you how long their name is. So what everyone else here has said applies, let me put it all together for you:
1. Prompt the user, asking them what their name is
2. Use a Scanner Object and the readLine method to read their name into a String
3. use the length() method of the String class to figure out how long their name is. Lets call this "nameLength"
4. Use a for loop to print out the *'s. Inside the for loop, have an if statement that says for (int i = 0; i < nameLength; i++){
//print the *'s and other stuff in here
}
Reputation Points: 874
Solved Threads: 352
Posting Maven
Offline 2,758 posts
since Sep 2008