Advertisement
Momnteiror2m

Vetores Código Array0

Sep 9th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.61 KB | None | 0 0
  1. package ListaVetores;
  2.  
  3. import javax.swing.*;
  4.  
  5. public class Array0 {
  6.  
  7.     public static void main(String[] args) {
  8.        
  9.         int cont;
  10.         int[] dados = new int[2];
  11.        
  12.         System.out.println(
  13.         "O n. de elem do array é: "+dados.length);
  14.        
  15.         for (cont=0; cont<2; cont++) {
  16.             dados[cont] = Integer.parseInt(
  17.             JOptionPane.showInputDialog(
  18.             "informe o valor pa ao indice "+cont));
  19.         }
  20.         for (int i=0;i<2;i++) {
  21.          System.out.println(
  22.          "O valor de indice "+i+
  23.          "vale "+dados[i]);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement