Java Reference
In-Depth Information
second = 2 * SECRET_NUM;
SECRET_NUM = SECRET_NUM + 3;
System.out.println(first + " " + second + " " + SECRET_NUM);
paycheck = hoursWorked * PAY_RATE
System.out.println("Wages = "
paycheck);
}
}
24. The following program has syntax errors. Correct them. On each successive
line, assume that any preceding error has been corrected.
import java.util.*;
public class Exercise24
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
int temp;
String first;
System.out.print("Enter first name: );
first = next();
System.out.println();
System.out.print("Enter last name: );
Last = console.next();
System.out.println();
System.out.print("Enter today's temperature: ");
temperature = nextInt();
System.out.println();
System.out.println(first + " " - last
+ " today's temperature is: ";
+ temperature);
}
}
25. The following program has syntax errors. Correct them. On each successive
line, assume that any preceding error has been corrected. After you have
corrected the syntax errors, type and compile the program to check if all
errors have been found.
public class Exercise25
{
static final char = STAR = '*'
static final int
PRIME = 71;
Search WWH ::




Custom Search