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...


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);



Dec 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here