Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Refer to image for questions 1 through 5 - Question 1: True or False: The main m

ID: 3856322 • Letter: R

Question

Refer to image for questions 1 through 5 -

Question 1: True or False: The main method is called on line 9 above.

Question 2: On line 18 above, the name of the method that is being called is:

a) JOptionPane

b) JOptionPane.showMessageDialog

c) showMessageDialog

d) Display a dialog box on the screen.

Question 3: On line 18 above, how many actuals are sent to the method?

a) 1

b) 2

c) 3

d) 4

Question 4: True or False: Line 23 above is an example of a method call.

Question 5: On line 17, two methods are called. Which method returns first?

a) round

b) random

Question 6: True or False:

Consider the following statement:

JOptionPane.showMessageDialog(null, "Tricky Question");

showMessageDialog is a static method in the JOptionPane class.

Question 7: Which of the following (choose all that apply) can you use as resources to determine the methods that are available for you to call in a program?

a) Ask a fellow college student or colleague

b) Use the "intelli-sense" in Netbeans

c) Search the internet

d) Study the API

e) Email a Java Programmer

Question 8: True or False: When you call a method, the method can return at most 1 value.

Question 9: Consider the following code fragment:

int n;

Point p;

Color c;

c = new Color(200, 50, 128);

n = c.getRed( );

The getRed method:

a) is defined in the Point Class

b) is found in the object c

c) is defined in the Color class

d) is found in the object p

e) returns an int

Question 10: True or False: In the following statement:

c = Color.getColor("Cyan");

getColor is a static method of the Color class.

identify method calls - NetBeans IDE 8.0 Eile Edit Yiew Navigate Source Refgctor Bun Debug Profile Team Iools Window Help . Search (C-I) config> public class IdentifyMethodCalls publie statie void aia(Stzingt args) 10 char c long n, quess, boolean correet-alse: Sering anum Scanner keyboard keyboard-neM Scanner (System.in) 13 14 15 16 17 18 19 20 21 Hath. round (Math randon0101) JOptionPane. shovMessageDialog (null, "Guess y number from 1 to 10 below. while (correct) "Guessing Game". JOpeionPane.PLAIN MESSAGE) Syatem.out-print(Enter your ques guess- keyboard.nexcLongO if (guessn) 23 24 Systese.out.printin ("Congrats! My number was. " n); correce -true 26 27 else 29 30 31 32 Syatem.out.printin("Nope Try again 34 main while (icorrect) 20:7 NS

Explanation / Answer

1.True

in every java program the exexution is first starts from main because it is static method that is

public static void main(String args[])

2.JOptionPane.showMessageDialog

the name of the method that is being called is JOptionPane.showMessageDialog and it can be call on JOptionPane

3.4

what we are passed at the time of method call the method is called actual parameters

4.false

here we evalutes the assignment operator(==) that is we check whether guess value is equal to n or not.

5.in java () have highest operator precedence so random() method returns first

6.JOptionPane.showMessageDialog(null, "Tricky Question"); is true because ,in java syntactic is is correct and t showMessageDialog is a not static method in the JOptionPane class.

7.Study the API

API means application program interfaces,jave apiprovides a clear explanation how to use methos ,class and..etc in API documentation.

8.false

it can be depends on method defination what u provided to it.

9.c) is defined in the Color class

you creted an object for the class i.e Color c = new Color(200, 50, 128);

so it is is defined in the Color class

10.false

getColor is a not static method of the Color class