Buscar

Q8. What is the difference between continue and break statement? break and continue are two important keywords used in Loops. When a break keyword...

Q8. What is the difference between continue and break statement?

break and continue are two important keywords used in Loops.
When a break keyword is used in a loop, loop is broken instantly while when continue keyword is used, current iteration is stopped and loop continues with next iteration.
a) Only 1 is correct.
b) Only 2 is correct.
c) Both 1 and 2 are correct.

Essa pergunta também está no material:

23 pág.

Linguagem de Programação Java Universidade PaulistaUniversidade Paulista

💡 1 Resposta

User badge image

Ed Verified user icon

A diferença entre as palavras-chave "continue" e "break" em loops é a seguinte: - Quando a palavra-chave "break" é usada em um loop, o loop é interrompido imediatamente e a execução continua fora do loop. - Quando a palavra-chave "continue" é usada em um loop, a iteração atual é interrompida e o loop continua com a próxima iteração. Portanto, a alternativa correta é a letra c) Ambas as afirmações 1 e 2 estão corretas.

0
Dislike0

✏️ Responder

SetasNegritoItálicoSublinhadoTachadoCitaçãoCódigoLista numeradaLista com marcadoresSubscritoSobrescritoDiminuir recuoAumentar recuoCor da fonteCor de fundoAlinhamentoLimparInserir linkImagemFórmula

Para escrever sua resposta aqui, entre ou crie uma conta

User badge image

Outros materiais