repl.it
@AlexLovelock/

Week 5 Private study Task 4

Java

No description

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.Scanner;
class Main {
   public static void main(String[] args) {
    Scanner input = new  Scanner(System.in);
    
    System.out.println("Enter your full name"); 
    String name = input.nextLine();

    int indexSpace = name.indexOf(" ");
    String lastname = name.substring(indexSpace+1);

    System.out.println("Hello  " + lastname);
  
   }
  
}