AllExam Dumps

DUMPS, FREE DUMPS, VCP5 DUMPS| VMWARE DUMPS, VCP DUMPS, VCP4 DUMPS, VCAP DUMPS, VCDX DUMPS, CISCO DUMPS, CCNA, CCNA DUMPS, CCNP DUMPS, CCIE DUMPS, ITIL, EXIN DUMPS,


READ Free Dumps For Oracle- 1z0-803





Question ID 21941

A method doSomething () that has no exception handling code is modified to trail a method that throws a
checked exception.
Which two modifications, made independently, will allow the program to compile?

Option A

Catch the exception in the method doSomething().

Option B

Declare the exception to be thrown in the doSomething() method signature.

Option C

Cast the exception to a RunTimeException in the doSomething() method.

Option D

Catch the exception in the method that calls doSomething().

Correct Answer A,B
Explanation Explanation: Valid Java programming language code must honor the Catch or Specify Requirement. This means that code that might throw certain exceptions must be enclosed by either of the following: * A try statement that catches the exception. The try must provide a handler for the exception, as described in Catching and Handling Exceptions. * A method that specifies that it can throw the exception. The method must provide a throws clause that lists the exception, as described in Specifying the Exceptions Thrown by a Method. Code that fails to honor the Catch or Specify Requirement will not compile.


Question ID 21942

Given the code fragment:
String color = "Red";
switch(color) {
case "Red":
System.out.println("Found Red");
case "Blue":
System.out.println("Found Blue");
break;
case "White":
System.out.println("Found White");
break;

default:
System.out.println("Found Default");
}
What is the result?

Option A

Found Red

Option B

Found Red
Found Blue

Option C

Found Red
Found Blue
Found White

Option D

Found Red
Found Blue
Found White
Found Default

Option F

Correct Answer: B

Explanation:
As there is no break statement after the case "Red" statement the case Blue statement will run as well.
Note: The body of a switch statement is known as a switch block. A statement in the switch block can be
labeled with one or more case or default labels. The switch statement evaluates its expression, then executes
all statements that follow the matching case label.

Each break statement terminates the enclosing switch statement. Control flow continues with the first statement
following the switch block. The break statements are necessary because without them, statements in switch
blocks fall through: All statements after the matching case label are executed in sequence, regardless of the
expression of subsequent case labels, until a break statement is encountered.

Correct Answer F
Explanation

Send email to admin@getfreedumps for new dumps request!!!