package sample.program;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class SampleProgram {
public static void main(String[] args) throws FileNotFoundException {
File file = new File("yahoo/yahoo.in");
Scanner scanner = new Scanner(file);
while (scanner.hasNext()) {
String[] inputs = scanner.nextLine().split( " ");
int[] number = new int[inputs.length];
for (int index = 0; index < inputs.length; index++) {
number[index] = Integer.parseInt(inputs[index]);
}
for (int index = 0; index < number.length; index++) {
System.out.println(number[index]);
}
for (int index = 0; index < inputs.length; index++) {
System.out.print(inputs[index] + " ");
}
System.out.println();
}
scanner.close();
}}
Walang komento:
Mag-post ng isang Komento