Question 34 :
Which of the following statements about the following code fragment are true?
Which of the following statements about the following code fragment are true?
Select 2 choices.
a.) The code compiles successfully and displays "Test".
b.) Changing the code at line 13 to "public void print(int x)" will allow the code to compile correctly.
c.) The code fails to compile. The compiler complains about duplicate methods.
d.) Changing the return type on line 13 from 'void' to 'int' will allow the code to compile correctly.
a.) The code compiles successfully and displays "Test".
b.) Changing the code at line 13 to "public void print(int x)" will allow the code to compile correctly.
c.) The code fails to compile. The compiler complains about duplicate methods.
d.) Changing the return type on line 13 from 'void' to 'int' will allow the code to compile correctly.
Question 35
What will be the result of running the following code?
a.) The output: Value is - Hello
b.) The output: Value is - Hello world
c.) A compiler error
d.) No output
e.) An exception
b.) The output: Value is - Hello world
c.) A compiler error
d.) No output
e.) An exception
Question 36:
Given the code below, which access modifiers (public, protected, or private) can legally be placed before the myMethod() method on line 3, if no other changes are made to the code? If line 3 is left as it is, which keywords can legally be placed before the myMethod method on line 8?
Choose one answer.
a. private or nothing (default) on line 3. Nothing (default) or protected or public on line 8.
b. public or protected on line 3. private or nothing (default) on line 8.
c. Nothing (default) or protected or public on line 3. private or nothing (default) on line 8.
d. public on line 3 and private on line8.
a. private or nothing (default) on line 3. Nothing (default) or protected or public on line 8.
b. public or protected on line 3. private or nothing (default) on line 8.
c. Nothing (default) or protected or public on line 3. private or nothing (default) on line 8.
d. public on line 3 and private on line8.
<<<Previous Page Next Page >>>