Created
September 25, 2017 19:44
-
-
Save MCMXCIII/83ac217b74f714734ace506aa24eba14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.StringTokenizer; | |
public class NameLab { | |
public static void main(String a[]){ | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Enter your last name."); | |
String lastName = sc.nextLine(); | |
System.out.println("Followed by your first and middle names."); | |
System.out.println("If you don\"t\" have a middle name enter \"None\"."); | |
String firstName= sc.nextLine(); | |
String middleName = sc.nextLine(); | |
String fullName = firstName + middleName + lastName; | |
//String msg = "This program gives sample code for String Tokenizer"; | |
StringTokenizer st = new StringTokenizer(fullName,", "); | |
while(st.hasMoreTokens()){ | |
System.out.println(st.nextToken()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment