DEV Community

FUNDAMENTOS JAVA
FUNDAMENTOS JAVA

Posted on

1

Teste do Capítulo 11

1. Como o uso de várias threads Java permite escrever programas mais eficientes?
2. O uso de várias threads é suportado pela classe _____ e pela interface ______.
3. Na criação de um objeto executável, por que pode ser melhor estender Thread em vez de implementar Runnable?
4. Mostre como podemos usar join( ) para esperar um objeto de thread chamado MyThrd terminar.
5. Mostre como configurar uma thread chamada MyThrd com três níveis acima da prioridade normal.
6. Qual é o efeito da inclusão da palavra-chave synchronized em um método?
7. Os métodos wait( ) e notify( ) são usados na execução da _________.
8. Altere a classe TickTock para que ela marque o tempo de verdade. Isto é, faça cada tique levar meio segundo e cada taque levar mais meio segundo. Logo, cada tique-taque levará um segundo. (Não se preocupe com o tempo necessário para alternar tarefas, etc.)
9. Por que você não pode usar suspend, resume( ) e stop( ) em programas novos?
10. Que método definido por Thread obtém o nome de uma thread?
11. O que isAlive( ) retorna?
12. Por sua própria conta, tente adicionar sincronização à classe Queue desenvolvida em capítulos anteriores para que seja seguro usá-la com várias threads.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay