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





Question ID 21459

Given:
import java.util.Scanner;
public class Painting {
public static void main(String[] args) {
String input = "Pastel, *Enamel, Fresco, *Gouache";
Scanner s = new Scanner(input);
s.useDelimiter(",\\s*");
while (s.hasNext()) {
System.out.println(s.next());
}
s.close();
}}
What is the result?

Option A

Pastel
Enamel
Fresco
Gouache

Option B

Pastel
*Enamel
Fresco
*Gouache

Option C

Pastel
Enamel
Fresco
Gouache

Option D

Pastel
Enamel, Fresco
Gouache

Correct Answer B
Explanation Explanation: B is correct regex explanation: , = , \ = masks the following \s = A whitespace character: [ \t \n \x0B \f \r ] * = Greedy Quantifier: zero or more times Delimiter: comma + zero or more whitespace characters


Question ID 21460

Given:
public class Test {
public static void main(String[] args) {
String[] arr = {"SE","ee","ME"};
for(String var : arr) {
try {
switch(var) {
case "SE":
System.out.println("Standard Edition");
break;
case "EE":
System.out.println("Enterprise Edition");
break;
default: assert false;
}
} catch (Exception e) {
System.out.println(e.getClass()); }
}
}
}
And the commands:
javac Test.java
java ea Test
What is the result?

Option A

Compilation fails

Option B

Standard Edition
Enterprise Edition
Micro Edition

Option C

Standard Edition
class java.lang.AssertionError
Micro Edition

Option D

Standard Edition is printed and an Assertion Error is thrown

Correct Answer D
Explanation Explanation: The command line : javac Test.java will compile the program. As for command line: java ea Test First the code will produce the output: Standard Edition See Note below. The ea option will enable assertions. This will make the following line in the switch statement to be run: default: assert false; This will throw an assertion error. This error will be caught. An the class of the assertion error (class java.lang.AssertionError) will be printed by the following line: System.out.println(e.getClass()); Note:The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method. The method declaration must look like the following: public static void main(String args[]) Paramater ea: -enableassertions[:"..." | : ] -ea[:"..." | : ] Enable assertions. Assertions are disabled by default. With no arguments, enableassertions or -ea enables assertions. Note 2: An assertion is a statement in the JavaTM programming language that enables you to test your assumptions about your program. Each assertion contains a boolean expression that you believe will be true when the assertion executes. If it is not true, the system will throw an error. public class AssertionError extends Error Thrown to indicate that an assertion has failed. Note 3: The javac command compiles Java source code into Java bytecodes. You then use the Java interpreter - the java command - to interprete the Java bytecodes. Reference:java - the Java application launcher Reference:java.langClass AssertionError