@GeorgeGibby/

Comp Sci Demo

Java

No description

fork
loading
Files
  • Main.java
  • Person.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner reader = new Scanner(System.in);
    System.out.println("Hello! What's your name?");
    String name = reader.nextLine();
    System.out.println("How old are you?");
    int age = reader.nextInt();
    System.out.println("What is your favorite color?");
    String color = reader.next();

    Person p1 = new Person(name, age, color);

    System.out.println(p1);
  }
}