mirror of
https://github.com/quinton-ashley/java2js
synced 2024-12-29 10:11:54 +01:00
21 lines
459 B
Java
21 lines
459 B
Java
package tests;
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class ScannerTest {
|
|
public static void main(String[] args) {
|
|
Scanner sc = new Scanner(System.in);
|
|
System.out.println("Hello world!");
|
|
|
|
System.out.print("What's your name: ");
|
|
String name = sc.nextLine();
|
|
System.out.println("Hello " + name);
|
|
|
|
System.out.print("What's your favorite number: ");
|
|
int age = sc.nextInt();
|
|
System.out.println(age + "? That's my favorite too!");
|
|
|
|
sc.close();
|
|
}
|
|
}
|