1. Examine the following method header, and then write an example call to the method:
public static void doSomething(int x)
2. Here is the code for the displayValue method, shown earlier in this chapter:
public static void displayValue(int num)
{
System.out.println("The value is " + num);
}
For each of the following code segments, indicate whether it will successfully compile
or cause an error:
a. displayValue(100);
b. displayValue(6.0);
c. short s = 5;
displayValue(s);
d. long num = 1;
displayValue(num);
e. displayValue(6.2f);
f. displayValue((int) 7.5);
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here