SóProvas


ID
2518090
Banca
FCC
Órgão
TRT - 24ª REGIÃO (MS)
Ano
2017
Provas
Disciplina
Algoritmos e Estrutura de Dados
Assuntos

Considere os seguintes comandos da linguagem Groovy para criar um array chamado tribunais:


I. String[] tribunais = ["TRT", "TRE", "TCU"]

II. def tribunais = ["TRT", "TRE", "TCU"] as String[]

III. def tribunais = (String[]) ["TRT", "TRE", "TCU"]

IV. def tribunais = ["TRT", "TRE", "TCU"] .toString(new Array( ))


Estão corretas as formas utilizadas APENAS em

Alternativas
Comentários
  • I. String[] tribunais = ["TRT", "TRE", "TCU"]

    II. def tribunais = ["TRT", "TRE", "TCU"] as String[]

    III. def tribunais = (String[]) ["TRT", "TRE", "TCU"]

    http://grails.asia/groovy-array-manipulation-examples

  • A opção IV está errada. O correto seria: def tribunais = ["TRT", "TRE", "TCU"].toArray(new String[0])

  • Força Guerreiro!!!!!!