Imput of a new array

public Integer[] Ingresarvector(int longitud) { Scanner teclado = new Scanner(System.in); Integer[] vector = new Integer[longitud]; for (int i = 0; i < vector.length; i++) { System.out.print("Ingrese el " + (i + 1) + " elemento: "); vector[i] = teclado.nextInt(); } teclado.close(); return vector; }
Method for create a new array of integer numbres with a length determined by the input parameter of the method.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.