Buscar

Exercicio3

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

/*
 * 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 exercicio3;
//classe que possibilita leitura de conteúdo inserido pelo usuário
import java.util.Scanner;
/**
 *
 * @author cliente
 */
public class Exercicio3 {
 /**
 * @param args the command line arguments
 */
 
 //Igor Cesar Sena Pereira - ADS 371 - 1540319
 //3. Armazenar seis nomes em uma matriz de ordem 2x3. Apresentar os nomes na tela.
 
 public static void main(String[] args) {
 // TODO code application logic here
 
 
 
 //Declaração de variáveis
 String [][] matr = new String [2][3];
 
 //Classe instanciada que possibilita a leitura
 Scanner lendo = new Scanner(System.in); 
 
 //RECEBENDO OS 6 nomes 
 for (int i = 0; i < 2; i++) 
 {
 for (int j = 0; j < 3; j++) 
 {
 System.out.println("Insira os nomes: ");
 matr[i][j] = lendo.nextLine();
 }
 }
 
 
 
 System.out.println("\nA Matriz ficou: \n");
 
 //exibindo matriz
 for(int i=0 ; i < 2 ; i++)
 {
 for(int j = 0; j < 3 ; j ++)
 {
 System.out.printf(matr[i][j]);
 }
 System.out.println(); 
 }
 }
 
}

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Continue navegando