Ir para conteúdo
Fórum Script Brasil

gabrielm.linassi

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Tudo que gabrielm.linassi postou

  1. Não entendi por que tem esse for loop externo e interno e qual o papel do if/else no código abaixo. Alguém pode me explicar? public class Main { public static void main (String [] args) { // TWO DIMENSIONAL ARRAY! [3][2]; String [][] states = new String[3][2]; states[0][0] = "California"; states[0][0] = "Sacramento"; states[1][0] = "Ohio"; states[1][1] = "Colombus"; states[2][0] = "New Mexico"; states[2][1] = "Santa Fe"; for(int i = 0; i<states.length; i++) { StringBuilder sb = new StringBuilder(); for (int i = 0; i<states.length[]) { if (j==0) { System.out.println("The capital of"); } else { System.out.println(" is "); } sb.append(states[j]); } System.out.println(sb); } } }
×
×
  • Criar Novo...