- import java.util.*;
- class Brain{
- public static void main(String[] args){
- //INSIRA O BLOCO DE CÓDIGO AKI…
- }
- }
Qual opção inserida independentemente na linha 5 compila e produz a saída “123 82”?(MARQUE TODAS CORRETAS)
OPÇÕES:
A) Scanner sc = new Scanner(“123 A C, 45 X5X, 76 82 L”);
while(sc.hasNextInt()) System.out.print(sc.nextInt() + " ");
B) Scanner sc = new Scanner(“123 A C, 45 X5X, 76 82 L”).useDelimiter(" ");
while() sc.hasNext()System.out.print(sc.nextInt() + " ");
C) Scanner sc = new Scanner(“123 A C, 45 X5X, 76 82 L”);
while(sc.hasNext()){
if(sc.hasNextInt()) System.out.print(sc.nextInt() + " ");
else sc.next(); }
D) Scanner sc = new Scanner(“123 A C, 45 X5X, 76 82 L”).seDelimiter(" ");
while(sc.hasNext()){
if(sc.hasNextInt()) System.out.print(sc.nextInt() + " ");
else sc.next(); }
E) Scanner sc = new Scanner(“123 A C, 45 X5X, 76 82 L”);
do{
if(sc.hasNextInt()) System.out.print(sc.nextInt() + " ");
}while (sc.hasNext() );
F) Scanner sc = new Scanner(“123 A C, 45 X5X, 76 82 L”).seDelimiter(" ");
do{
if(sc.hasNextInt()) System.out.print(sc.nextInt() + " ");
}while (sc.hasNext() );
RESPOSTA: C e D.
Alguem poderia dar uma força nessa resposta, ja revisei o assunto mas não compreendi muito bem…
vlw t+

