Skip to content

Instantly share code, notes, and snippets.

@imduffy15
imduffy15 / LargestFromTextFile.java
Created October 12, 2013 18:42
Find largest number in a text file with java
import java.io.*;
import java.util.*;
class LargestFromTextFile {
public static void main(String[] args) {
try {
Scanner file = new Scanner(new File("numbers.txt"));
int largest = file.nextInt();
while(file.hasNextInt()) {