diff --git a/input.txt b/input.txt new file mode 100644 index 0000000..76441a2 --- /dev/null +++ b/input.txt @@ -0,0 +1 @@ +Roxane 28 \ No newline at end of file diff --git a/project-files/ReadFile.java b/project-files/ReadFile.java new file mode 100644 index 0000000..27ff734 --- /dev/null +++ b/project-files/ReadFile.java @@ -0,0 +1,17 @@ +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + +public class ReadFile { + public static void main(String[] args) throws FileNotFoundException { + File file = new File("input.txt"); + Scanner scanner = new Scanner(file); + + String name = scanner.next(); + int age = scanner.nextInt(); + + scanner.close(); + System.out.println("Name: " + name); + System.out.println("Age: " + age); + } +} \ No newline at end of file