int top = 4, n = -1;
while(n <= top)
{
switch(n)
{
case 1:
System.out.println(" One. ");
break;
case 3:
System.out.println("Three.");
,break;
case 4:
System.out.println("Four.");
break;
default:
System.out.println("Default case.");
break;
}
n++;
}
Give this one a try later!
Default case
Default case
One
Default Case
Three
Four
Suppose number is a variable of type int that has been given a value. Write a multi-
branch if-else statement that outputs the String "High" if number is greater than 10, the
String "low" if number is less than 5, and the String "So-so" if number is anything else.
Give this one a try later!
f(number > 10)
System.out.println("High");
else if ( number < 5)
System.out.println("Low");
else
System.out.println("So-so");
Executable Statement
, Give this one a try later!
line of code which ends with a ;
ASCII
Give this one a try later!
subset of the unicode characterset mapping the set of keyboard characters
to integers that can be stored in the computer
Identifier
Give this one a try later!
programmer created name of a variable
Write a loop that prompts for a negative number. It prints the number and continues
prompting and reading and printing numbers until a negative number is read.
Give this one a try later!
Scanner scan = new Scanner(System.in);
int numbers;
System.out.println( "Eneter a negative number:");
number = scan.nextInt();
System.out.println("You entered " + number);
while (numbers >= 0)
{
System.out.println( "Eneter a negative number:");