Skip to content

Instantly share code, notes, and snippets.

@LionelBeato
Created October 7, 2020 19:52
Show Gist options
  • Save LionelBeato/a9c51df639e66ea1f13062908f46c667 to your computer and use it in GitHub Desktop.
Save LionelBeato/a9c51df639e66ea1f13062908f46c667 to your computer and use it in GitHub Desktop.
Scanner example and LocalDate example
import java.time.LocalDate;
import java.util.*;
//import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// how to make the scanner object
Scanner scan = new Scanner(System.in);
// reading input from the scanner
System.out.println("Input a word:");
String x = scan.nextLine();
// output our read information
System.out.println(x);
scan.close();
// time package overview
LocalDate today = LocalDate.now();
System.out.println(today);
LocalDate dateOfBirth = LocalDate.of(1990, 8, 16);
System.out.println(dateOfBirth);
// TODO ask for name, birthday, and print them to the console
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment