-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample_2_9.java
More file actions
27 lines (23 loc) · 897 Bytes
/
Example_2_9.java
File metadata and controls
27 lines (23 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package unit_02.Examples.Example_09;
import java.util.Scanner;
public class Example_2_9 {
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args){
String firstName, lastName, line;
int age;
double weight;
System.out.print("Enter first name, last name, " +
"age, and weight separted by space:\n");
line = scanner.nextLine();
System.out.println("Line is " + line);
System.out.print("Enter first name, last name, " +
"age, and weight separted by space:\n");
firstName = scanner.next();
lastName = scanner.next();
age = scanner.nextInt();
weight = scanner.nextDouble();
System.out.println("Name: " + firstName + " " + lastName);
System.out.println("Age: " + age);
System.out.println("Weight: " + weight);
}
}