Escolar Documentos
Profissional Documentos
Cultura Documentos
a) while (c <= 5)
{
produto * = c;
++ c;
b) if (gender == 1)
System.out.println ("Woman");
else;
System.out.println ("Man");
3. Modifique o código fornecido para produzir a saída mostrada em cada alínea. Use
técnicas de indentação adequadas. Não faça outras alterações além de inserir
chavetas e indentação.
Modify the code provided to produce the output shown in each case. Use proper
indentation techniques. Do not make changes other than insert braces and indentation.
if (y == 8)
if (x == 5)
System.out.println ("@@@@@");
else
System.out.println ("#####");
System.out.println ("$$$$$");
System.out.println ("&&&&&");
b) O código a seguir deve ser impresso se o valor inteiro for ímpar ou par:
The following code should print if the integer value is odd or even:
switch ( value % 2 )
{
case 0:
System.out.println( "Even integer" );
case 1:
System.out.println( "Odd integer" );
}
counter = 2;
do
{
System.out.println( counter );
counter += 2;
} While ( counter < 100 );
Programação Orientada a Objetos