Advertisement
mcnealk

Quiz#3

Oct 2nd, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import java.util.*;
  2. public class Quiz3
  3. {
  4. public static void main(String[] args)
  5. {
  6. Scanner console=new Scanner (System.in);
  7. System.out.print("Type your name: ");
  8. String name= console.nextLine();
  9. String last=name.substring(name.indexOf(" ") + 1);
  10. String first = name.substring(0, 1);
  11. System.out.print("Your name is " + last + ", " + first + ".");
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement