Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Quiz3
- {
- public static void main(String[] args)
- {
- Scanner console=new Scanner (System.in);
- System.out.print("Type your name: ");
- String name= console.nextLine();
- String last=name.substring(name.indexOf(" ") + 1);
- String first = name.substring(0, 1);
- System.out.print("Your name is " + last + ", " + first + ".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement