Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner sc = new Scanner(file);
- while (sc.hasNextLine()) {
- String line = sc.nextLine();
- System.out.println(line);
- //Find the largest and smallest numbers in the file
- double largest = sc.nextDouble();
- double smallest = sc.nextDouble();
- while (sc.hasNextDouble()) {
- double number = sc.nextDouble();
- if ( number < largest ) {
- largest = number;
- while(sc.hasNextDouble()) {
- if (number > smallest)
- smallest = number;
- "Exception in thread "main" java.util.NoSuchElementException
- at java.util.Scanner.throwFor(Scanner.java:862)
- at java.util.Scanner.next(Scanner.java:1485)
- at java.util.Scanner.nextDouble(Scanner.java:2413)
- at Numbers3.main(Numbers3.java:24)".
Add Comment
Please, Sign In to add comment