Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package tutoetc;
- import java.util.Random;
- /**
- *
- * @author WIF170097
- */
- //import java.io.PrintWriter;
- //import java.io.FileOutputStream;
- //import java.io.IOException;
- import java.io.*;
- import java.util.*;
- public class Tutoetc {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- int max=0,num;
- try {
- Scanner inputStream = new Scanner(new FileInputStream("integer.txt"));
- System.out.println("the list of integer is ");
- while(inputStream.hasNextInt())
- {
- num=inputStream.nextInt();
- System.out.print(num +" ");
- if(num>max)
- max=num;
- }
- System.out.println();
- System.out.println("The largest integer is "+max);
- inputStream.close();
- } catch (FileNotFoundException e) {
- System.out.println("File was not found");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement