Guest User

Untitled

a guest
Mar 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package Prac2;
  2.  
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.util.Scanner;
  6. import java.io.*;
  7.  
  8. public class Practica {
  9.  
  10.  
  11. public static int [] leefichero(String nombrefichero) throws FileNotFoundException {
  12.  
  13. Scanner entrada = new Scanner(new File(nombrefichero));
  14.  
  15. int lon = entrada.nextInt();
  16. int [] vector = new int[lon];
  17. for (int i=0; i<lon; i++){
  18. vector[i] = entrada.nextInt();
  19. }
  20. entrada.close();
  21. return vector;
  22.  
  23. }
  24.  
  25. public static void main(String[] args){
  26. int result [] = leefichero("Fichero.txt");
  27. }
  28.  
  29. }
Add Comment
Please, Sign In to add comment