Code example for Scanner

Methods: close

0
		File outputFile = new File(args[1]);
		if (!inputFile.exists()) {
			throw new WrongCommandLineArgumentException( 
					"Input file not found (" + args[0] + ").");
		} 
		Scanner input = new Scanner(inputFile);
 
		Matrix m1 = Matrix.createMatrix(input);
		Matrix m2 = Matrix.createMatrix(input);
		Matrix m3 = Matrix.createMatrix(input);
		 
		 
		Matrix ans = m1.multiply(m1).add(m2.multiply(m3)); 
		ans.write(outputFile);
 
		input.close();
	} 
}