Test 1Z0-809

Question 1:
Given:
class RateOfInterest {
public static void main (String[] args) {
int rateOfInterest = 0;
String accountType = "LOAN";
switch (accountType) {
case "RD";
rateOfInterest = 5;
break;
case "FD";
rateOfInterest = 10;
break;
default:
assert false: "No interest for this account"; //line n1
}
System.out.println ("Rate of interest:" + rateOfInterest);
}
}
and the command:
java ""ea RateOfInterest
What is the result?

A.
Rate of interest: 0
B.
An AssertionError is thrown.
C.
No interest for this account
D.
A compilation error occurs at line n1.

Question 2:
Given:
interface Doable {
public void doSomething (String s);
}
Which two class definitions compile? (Choose two.)

A.
public class Task implements Doable { public void doSomethingElse(String s) { } }
B.
public abstract class Work implements Doable { public abstract void doSomething(String s) { } public void doYourThing(Boolean b) { } }
C.
public abstract class Job implements Doable { public void doSomething(Integer i) { } }
D.
public class Action implements Doable { public void doSomething(Integer i) { } public String doThis(Integer j) { } }
E.
public class Do implements Doable { public void doSomething(Integer i) { } public void doSomething(String s) { } public void doThat (String s) { } }

Question 3:
Given:
class Vehicle {
int vno;
String name;
public Vehicle (int vno, String name) {
this.vno = vno,;
this.name = name;
}
public String toString () {
return vno + ":" + name;
}
}
and this code fragment:
Set vehicles = new TreeSet <> ();
vehicles.add(new Vehicle (10123, "Ford"));
vehicles.add(new Vehicle (10124, "BMW"));
System.out.println(vehicles);
What is the result?

A.
10123 Ford 10124 BMW
B.
10124 BMW 10123 Ford
C.
A compilation error occurs.
D.
A ClassCastException is thrown at run time.

Question 4:
Given the code fragment:

What is the result?

A.
text1text2
B.
text1text2text2text3
C.
text1
D.
[text1, text2]

Question 5:
Given the code fragment:

What is the result?

A.
Val:20 Val:40 Val:60
B.
Val:10 Val:20 Val:30
C.
A compilation error occurs.
D.
Val: Val: Val:

Question 6:
Given the code fragment:
Path file = Paths.get ("courses.txt");
// line n1
Assume the courses.txt is accessible.
Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?

A.
List fc = Files.list(file); fc.stream().forEach (s - > System.out.println(s));
B.
Stream fc = Files.readAllLines (file); fc.forEach (s - > System.out.println(s));
C.
List fc = readAllLines(file); fc.stream().forEach (s - > System.out.println(s));
D.
Stream fc = Files.lines (file); fc.forEach (s - > System.out.println(s));

Question 7:
Given the code fragment:

What is the result?

A.
A compilation error occurs at line n1.
B.
Logged out at: 2015-01-12T21:58:19.880Z
C.
Can't logout
D.
Logged out at: 2015-01-12T21:58:00Z

Question 8:
Given the code fragment:

What is the result?

A.
A compilation error occurs at line n2.
B.
3
C.
2
D.
A compilation error occurs at line n1.

Question 9:
Given the code fragment:
List colors = Arrays.asList("red", "green", "yellow");
Predicate test = n - > {
System.out.println("Searching"¦");
return n.contains("red");
};
colors.stream()
.filter(c -> c.length() >= 3)
.allMatch(test);
What is the result?

A.
Searching"¦
B.
Searching"¦ Searching"¦
C.
Searching"¦ Searching"¦ Searching"¦
D.
A compilation error occurs.

Question 10:
Given the code fragment:

What is the result?

A.
5 : 3 : 6
B.
6 : 5 : 6
C.
3 : 3 : 4
D.
4 : 4 : 4

Question 11:
Given:

What is the result?

A.
Bar Hello Foo Hello
B.
Bar Hello Baz Hello
C.
Baz Hello
D.
A compilation error occurs in the Daze class.

Question 12:
Given the code fragment:
List list1 = Arrays.asList(10, 20);
List list2 = Arrays.asList(15, 30);
//line n1
Which code fragment, when inserted at line n1, prints 10 20 15 30?

A.
Stream.of(list1, list2) .flatMap(list -> list.stream()) .forEach(s -> System.out.print(s + " "));
B.
Stream.of(list1, list2) .flatMap(list -> list.intStream()) .forEach(s -> System.out.print(s + " "));
C.
list1.stream() .flatMap(list2.stream().flatMap(e1 -> e1.stream()) .forEach(s -> System.out.println(s + " "));
D.
Stream.of(list1, list2) .flatMapToInt(list -> list.stream()) .forEach(s -> System.out.print(s + " "));

Question 13:
Given the content:
and the code fragment:

What is the result?

A.
username = Entrez le nom d'utilisateur password = Entrez le mot de passe
B.
username = Enter User Name password = Enter Password
C.
A compilation error occurs.
D.
The program prints nothing.

Question 14:
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () < 6) {
throw new UserException ();
} else if (age >= 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
What is the result?

A.
User is registered.
B.
An AgeOutOfLimitException is thrown.
C.
A UserException is thrown.
D.
A compilation error occurs in the main method.

Question 15:
Given:

What is the result?

A.
IT:null
B.
A NullPointerException is thrown at run time.
C.
A compilation error occurs.
D.
IT:0.0

Question 16:
Given:
and the code fragment:

What is the result?

A.
true true
B.
false true
C.
false false
D.
true false

Question 17:
Given the code fragment:
UnaryOperator uo1 = s -> s*2; //line n1
List loanValues = Arrays.asList(1000.0, 2000.0);
loanValues.stream()
.filter(lv -> lv >= 1500)
.map(lv -> uo1.apply(lv)) //line n2
.forEach(s -> System.out.print(s + " "));
What is the result?

A.
4000.0
B.
4000
C.
A compilation error occurs at line n1.
D.
A compilation error occurs at line n2.

Question 18:
Given the code fragment:
class CallerThread implements Callable {
String str;
public CallerThread(String s) {this.str=s;}
public String call() throws Exception {
return str.concat("Call");
}
}
and
public static void main (String[] args) throws InterruptedException, ExecutionException
{
ExecutorService es = Executors.newFixedThreadPool(4); //line n1
Future f1 = es.submit (newCallerThread("Call"));
String str = f1.get().toString();
System.out.println(str);
}
Which statement is true?
Call Call and terminates.

A.
The program prints Call Call and does not terminate.
B.
The program prints line n1.
C.
A compilation error occurs at ExecutionException is thrown at run time.
D.
An

Question 19:
Given the records from the Employee table:
and given the code fragment: try {
Connection conn = DriverManager.getConnection (URL, userName, passWord);
Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
st.execute("SELECT*FROM Employee");
ResultSet rs = st.getResultSet();
while (rs.next()) {
if (rs.getInt(1) ==112) {
rs.updateString(2, "Jack");
}
}
rs.absolute(2);
System.out.println(rs.getInt(1) + " " + rs.getString(2));
} catch (SQLException ex) {
System.out.println("Exception is raised");
}
Assume that:
The required database driver is configured in the classpath.
The appropriate database accessible with the URL, userName, and passWord exists.
What is the result?

A.
The Employee table is updated with the row: 112 Jack and the program prints: 112 Jerry
B.
The Employee table is updated with the row: 112 Jack and the program prints: 112 Jack
C.
The Employee table is not updated and the program prints: 112 Jerry
D.
The program prints Exception is raised.

Question 20:
Given the code fragments:
class TechName {
String techName;
TechName (String techName) {
this.techName=techName;
}
}
and
List tech = Arrays.asList (
new TechName("Java-"),
new TechName("Oracle DB-"),
new TechName("J2EE-")
);
Stream stre = tech.stream();
//line n1
Which should be inserted at line n1 to print Java-Oracle DB-J2EE-?

A.
stre.forEach(System.out::print);
B.
stre.map(a-> a.techName).forEach(System.out::print);
C.
stre.map(a-> a).forEachOrdered(System.out::print);
D.
stre.forEachOrdered(System.out::print);

Question 21:
Given the code fragment:
public static void main (String[] args) throws IOException {
BufferedReader brCopy = null;
try (BufferedReader br = new BufferedReader (new FileReader("employee.txt"))) { // line n1 br.lines().forEach(c -> System.out.println(c)); brCopy = br; //line n2
}
brCopy.ready(); //line n3;
}
Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text.
What is the result?

A.
A compilation error occurs at line n3.
B.
A compilation error occurs at line n1.
C.
A compilation error occurs at line n2.
D.
The code prints the content of the employee.txt file and throws an exception at line n3.

Question 22:
java.time.Duration?

Which statement is true about -

A.
It tracks time zones.
B.
It preserves daylight saving time.
C.
It defines time-based values.
D.
It defines date-based values.

Question 23:
Given the code fragment:
Path path1 = Paths.get("/app/./sys/");
Path res1 = path1.resolve("log");
Path path2 = Paths.get("/server/exe/");
Path res1 = path1.resolve("/readme/");
System.out.println(res1);
System.out.println(res2);
What is the result?

A.
/app/sys/log /readme/server/exe
B.
/app/log/sys /server/exe/readme
C.
/app/./sys/log /readme
D.
/app/./sys/log /server/exe/readme

Question 24:
Which statement is true about java.util.stream.Stream?

A.
A stream cannot be consumed more than once.
B.
The execution mode of streams can be changed during processing.
C.
Streams are intended to modify the source data.
D.
A parallel stream is always faster than an equivalent sequential stream.
E.
Stream operation accepts lambda expressions as its parameters.

Question 25:
Given the code fragment:
9. Connection conn = DriveManager.getConnection(dbURL, userName, passWord);
10. String query = "SELECT id FROM Employee";
11. try (Statement stmt = conn.createStatement()) {
12. ResultSet rs = stmt.executeQuery(query);
13. stmt.executeQuery("SELECT id FROM Customer");
14. while (rs.next()) {
15. //process the results
16. System.out.println("Employee ID: "+ rs.getInt("id"));
17. }
18. } catch (Exception e) {
19. System.out.println ("Error");
20. }
Assume that:
The required database driver is configured in the classpath.
dbURL, userName, and passWord exists.
The appropriate database is accessible with the
Employee and Customer tables are available and each table has id column with a few records and the SQL queries are valid.

The -
What is the result of compiling and executing this code fragment?

A.
The program prints employee IDs.
B.
The program prints customer IDs.
C.
The program prints Error.
D.
compilation fails on line 13.

Question 26:
Given:
public class Canvas implements Drawable {
public void draw () { }
}
public abstract class Board extends Canvas { }
public class Paper extends Canvas {
protected void draw (int color) { }
}
public class Frame extends Canvas implements Drawable {
public void resize () { }
}
public interface Drawable {
public abstract void draw ();
}
Which statement is true?

A.
Board does not compile.
B.
Paper does not compile.
C.
Frame does not compile.
D.
Drawable does not compile.
E.
All classes compile successfully.

Question 27:
Given the code fragment:
List nums = Arrays.asList (10, 20, 8):
System.out.println (
//line n1
);
line n1 to enable the code to print the maximum number in the nums list?
Which code fragment must be inserted at

A.
nums.stream().max(Comparator.comparing(a -> a)).get()
B.
nums.stream().max(Integer : : max).get()
C.
nums.stream().max()
D.
nums.stream().map(a -> a).max()

Question 28:
The data.doc, data.txt and data.xml files are accessible and contain text.
Given the code fragment:
Stream paths = Stream.of (Paths. get("data.doc"),
Paths. get("data.txt"),
Paths. get("data.xml"));
paths.filter(s-> s.toString().contains("data")).forEach(
s -> {
try {
Files.readAllLines(s)
.stream()
.forEach(System.out::println); //line n1
} catch (IOException e) {
System.out.println("Exception");
}
}
);
What is the result?

A.
The program prints the content of data.txt file.
B.
The program prints: Exception <> <>
C.
A compilation error occurs at line n1.
D.
The program prints the content of the three files.

Question 29:
Given the code fragment:
List codes = Arrays.asList (10, 20);
UnaryOperator uo = s -> s +10.0;
codes.replaceAll(uo);
codes.forEach(c -> System.out.println(c));
What is the result?

A.
20.0 30.0
B.
10.0 20.0
C.
A compilation error occurs.
D.
A NumberFormatException is thrown at run time.

Question 30:
Given the definition of the Vehicle class:
Class Vehicle {
int distance;
Vehicle (int x) {
this distance = x;
}
public void increSpeed(int time) {
int timeTravel = time; //line n1
//line n3
class Car {
int value = 0;
public void speed () {
value = distance /timeTravel; //line n2
System.out.println ("Velocity with new speed"+value+"kmph");
}
}
speed(); //line n3
}
}
and this code fragment:
Vehicle v = new Vehicle (100);
v.increSpeed(60);
What is the result?

A.
Velocity with new speed 1 kmph
B.
A compilation error occurs at line n1.
C.
A compilation error occurs at line n2.
D.
A compilation error occurs at line n3.

Question 31:
Given:
1. abstract class Shape {
2. Shape ( ) { System.out.println ("Shape"); }
3. protected void area ( ) { System.out.println ("Shape"); }
4. }
5.
6. class Square extends Shape {
7. int side;
8. Square int side {
9. /* insert code here */
10. this.side = side;
11. }
12. public void area ( ) { System.out.println ("Square"); }
13. }
14. class Rectangle extends Square {
15. int len, br;
16. Rectangle (int x, int y) {
17. /* insert code here */
18. len = x, br = y;
19. }
20. void area ( ) { System.out.println ("Rectangle"); }
21. }
Which two modifications enable the code to compile? (Choose two.)

A.
At line 1, remove abstract
B.
At line 9, insert super ( );
C.
At line 12, remove public
D.
At line 17, insert super (x);
E.
At line 17, insert super (); super.side = x;
F.
At line 20, use public void area ( ) {

Question 32:
Given the code fragment:
Stream> iStr= Stream.of (
Arrays.asList ("1", "John"),
Arrays.asList ("2", null));
Stream< nInSt = iStr.flatMapToInt ((x) -> x.stream ()); nInSt.forEach (System.out :: print);
What is the result?

A.
1John2null
B.
12
C.
A NullPointerException is thrown at run time.
D.
A compilation error occurs.

Question 33:
Given:
IntStream stream = IntStream.of (1,2,3);
IntFunction inFu= x -> y -> x*y; //line n1
IntStream newStream = stream.map(inFu.apply(10)); //line n2 newStream.forEach(System.output::print);
Which modification enables the code fragment to compile?

A.
Replace line n1 with: IntFunction inFu = x -> y -> x*y;
B.
Replace line n1 with: IntFunction inFu = x -> y -> x*y;
C.
Replace line n1 with: BiFunction inFu = x -> y -> x*y;
D.
Replace line n2 with: IntStream newStream = stream.map(inFu.applyAsInt (10));

Question 34:
Given:
class Sum extends RecursiveAction { //line n1 static final int THRESHOLD_SIZE = 3; int stIndex, lstIndex; int [ ] data; public Sum (int [ ]data, int start, int end) { this.data = data; this stIndex = start; this. lstIndex = end;
}
protected void compute ( ) {
int sum = 0;
if (lstIndex "" stIndex <= THRESHOLD_SIZE) {
for (int i = stIndex; i < lstIndex; i++) {
sum += data [i];
}
System.out.println(sum);
} else {
new Sum (data, stIndex + THRESHOLD_SIZE, lstIndex).fork( );
new Sum (data, stIndex,
Math.min (lstIndex, stIndex + THRESHOLD_SIZE)
).compute ();
}
}
}
and the code fragment:
ForkJoinPool fjPool = new ForkJoinPool ( );
int data [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
fjPool.invoke (new Sum (data, 0, data.length));
and given that the sum of all integers from 1 to 10 is 55.
Which statement is true?

A.
The program prints several values that total 55.
B.
The program prints 55.
C.
A compilation error occurs at line n1.
D.
The program prints nothing.

Question 35:
Given:
class Bird {
public void fly () { System.out.print("Can fly"); }
}
class Penguin extends Bird {
public void fly () { System.out.print("Cannot fly"); }
}
and the code fragment:
class Birdie {
public static void main (String [ ] args) {
fly( ( ) -> new Bird ( ));
fly (Penguin : : new);
}
/* line n1 */
}
Which code fragment, when inserted at line n1, enables the Birdie class to compile?

A.
static void fly (Consumer bird) { bird :: fly (); }
B.
static void fly (Consumer bird) { bird.accept( ) fly (); }
C.
static void fly (Supplier bird) { bird.get( ) fly (); }
D.
static void fly (Supplier bird) { bird::fly(); }

Question 36:
Given the code fragment:
public void recDelete (String dirName) throws IOException {
File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) {
if (aFile.isDirectory ()) {
recDelete (aFile.getAbsolutePath ());
} else {
if (aFile.getName ().endsWith (".class"))
aFile.delete ();
}
}
}
}
Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.
What is the result?

A.
The method deletes all the .class files in the Projects directory and its subdirectories.
B.
The method deletes the .class files of the Projects directory only.
C.
The method executes and does not make any changes to the Projects directory.
D.
The method throws an IOException.

Question 37:
Given the code fragment:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate nextYear = valentinesDay.plusYears(1);
nextYear.plusDays(15); //line n1
System.out.println(nextYear);
What is the result?

A.
2016-02-14 DateTimeException is thrown.
B.
A
C.
2016-02-29 line n1.
D.
A compilation error occurs at

Question 38:
Given the code fragment:
Map books = new TreeMap<>();
books.put (1007, "A");
books.put (1002, "C");
books.put (1001, "B");
books.put (1003, "B");
System.out.println (books);
What is the result?

A.
{1007 = A, 1002 = C, 1001 = B, 1003 = B} {1001 = B, 1002 = C, 1003 = B, 1007 = A} B.
C.
{1002 = C, 1003 = B, 1007 = A}
D.
{1007 = A, 1001 = B, 1003 = B, 1002 = C}

Question 39:
Given the definition of the Vehicle class:
class Vehicle {
String name;
void setName (String name) {
this.name = name;
}
String getName() {
return name;
}
}
Which action encapsulates the Vehicle class?
Vehicle class public.

A.
Make the name variable public.
B.
Make the setName method public.
C.
Make the name variable private.
D.
Make the setName method private.
E.
Make the getName method private.
F.
Make the

Question 40:
Given the code fragment:
List empDetails = Arrays.asList("100, Robin, HR",
"200, Mary, AdminServices",
"101, Peter, HR");
empDetails.stream()
.filter(s-> s.contains("1"))
.sorted()
.forEach(System.out::println); //line n1
What is the result?

A.
100, Robin, HR 101, Peter, HR line n1.
B.
A compilation error occurs at
C.
100, Robin, HR 101, Peter, HR 200, Mary, AdminServices
D.
100, Robin, HR 200, Mary, AdminServices

Question 41:
Given the code fragment:
Path path1 = Paths.get("/app/./sys/");
Path res1 = path1.resolve("log");
Path path2 = Paths.get("/server/exe/");
Path res2 = path2.resolve("/readme/");
System.out.println(res1);
System.out.println(res2);
What is the result?

A.
/app/sys/log /readme/server/exe
B.
/app/log/sys /server/exe/readme
C.
/app/./sys/log /readme
D.
/app/./sys/log /server/exe/readme

Question 42:
Given the code fragment:
Stream files = Files.list(Paths.get(System.getProperty("user.home"))); files.forEach (fName -> { //line n1 try {
Path aPath = fName.toAbsolutePath(); //line n2
System.out.println(fName + ":"
+ Files.readAttributes(aPath, Basic.File.Attributes.class).creationTime
());
} catch (IOException ex) {
ex.printStackTrace();
});
What is the result?

A.
All files and directories under the home directory are listed along with their attributes.
B.
A compilation error occurs at line n1.
C.
The files and folders in the home directory are listed along with their attributes.
D.
A compilation error occurs at line n2.

Question 43:
Given the code fragment:
public void recDelete (String dirName) throws IOException {
File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) {
if (!aFile.isDirectory ()) {
if (aFile.getName ().endsWith (".class"))
aFile.delete ();
}
}
}
}
Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.
What is the result?

A.
The method deletes all the .class files in the Projects directory and its subdirectories.
B.
The method deletes the .class files of the Projects directory only.
C.
The method executes and does not make any changes to the Projects directory.
D.
The method throws an IOException.

Question 44:
Given the code fragment:
List empDetails = Arrays.asList("100, Robin, HR", "200, Mary, AdminServices","101, Peter, HR"); empDetails.stream()
.filter(s-> s.contains("r"))
.sorted()
.forEach(System.out::println); //line n1
What is the result?

A.
100, Robin, HR 101, Peter, HR
B.
E. A compilation error occurs at line n1.
C.
101, Peter, HR 200, Mary, AdminServices
D.
100, Robin, HR 200, Mary, AdminServices 101, Peter, HR

Question 45:
Given:

Item table -
"¢ ID, INTEGER: PK
"¢ DESCRIP, VARCHAR(100)
"¢ PRICE, REAL
"¢ QUANTITY< INTEGER
And given the code fragment:
9. try {
10. Connection conn = DriveManager.getConnection(dbURL, username, password);
11. String query = "Select * FROM Item WHERE ID = 110";
12. Statement stmt = conn.createStatement();
13. ResultSet rs = stmt.executeQuery(query);
14. while(rs.next()) {
15. System.out.println("ID: " + rs.getString(1));
16. System.out.println("Description: " + rs.getString(2));
17. System.out.println("Price: " + rs.getString(3));
18. System.out.println(Quantity: " + rs.getString(4));
19. }
20. } catch (SQLException se) {
21. System.out.println("Error");
22. }
Assume that:
The required database driver is configured in the classpath.
The appropriate database is accessible with the dbURL, userName, and passWord exists.
The SQL query is valid.
What is the result?

A.
An exception is thrown at runtime.
B.
Compilation fails.
C.
The code prints Error.
D.
The code prints information about Item 110.

Question 46:
Given:
class Book {
int id;
String name;
public Book (int id, String name) {
this.id = id;
this.name = name;
}
public boolean equals (Object obj) { //line n1
boolean output = false;
Book b = (Book) obj;
if (this.id = = b.id) {
output = true;
}
return output;
}
}
and the code fragment:
Book b1 = new Book (101, "Java Programing");
Book b2 = new Book (102, "Java Programing");
System.out.println (b1.equals(b2)); //line n2
Which statement is true?

A.
The program prints true.
B.
The program prints false.
C.
A compilation error occurs. To ensure successful compilation, replace line n1 with: boolean equals (Book obj) {
D.
A compilation error occurs. To ensure successful compilation, replace line n2 with: System.out.println (b1.equals((Object) b2));

Question 47:
Given:

Which option fails?

A.
Foo mark = new Foo ("Steve", 100);
B.
Foo pair = Foo.twice ("Hello World!");
C.
Foo percentage = new Foo("Steve", 100);
D.
Foo grade = new Foo <> ("John", "A");

Question 48:
Given:
public class Counter {
public static void main (String[ ] args) {
int a = 10;
int b = -1;
assert (b >=1) : "Invalid Denominator";
int Ñ = a / b;
System.out.println (c);
}
}
What is the result of running the code with the ""da option?

A.
-10
B.
C.
An AssertionError is thrown.
D.
A compilation error occurs.

Question 49:
Given:
class UserException extends Exception { }
class AgeOutOfLimitException extends UserException { }
and the code fragment:
class App {
public void doRegister(String name, int age)
throws UserException, AgeOutOfLimitException {
if (name.length () <= 60) {
throw new UserException ();
} else if (age > 60) {
throw new AgeOutOfLimitException ();
} else {
System.out.println("User is registered.");
}
}
public static void main(String[ ] args) throws UserException {
App t = new App ();
t.doRegister("Mathew", 60);
}
}
What is the result?

A.
User is registered.
B.
An AgeOutOfLimitException is thrown.
C.
A UserException is thrown.
D.
A compilation error occurs in the main method.

Question 50:
Given the code fragment:
Path path1 = Paths.get("/app/./sys/");
Path res1 = path1.resolve("log");
Path path2 = Paths.get("/server/exe/");
Path res1 = path2.resolve("/readme/");
System.out.println(res1);
System.out.println(res2);
What is the result?

A.
/app/sys/log /readme/server/exe
B.
/app/log/sys /server/exe/readme
C.
/app/./sys/log /readme
D.
/app/./sys/log /server/exe/readme

Disclaimer:
The content on this webpage is collected from various internet sources. While we strive for accuracy, we cannot guarantee its completeness or correctness. Please use it with caution and conduct further research if needed. We do not claim ownership or copyright over any content. If you find any copyrighted material or content that violates laws, please contact us for removal. By accessing this webpage, you agree to these terms. Thank you for your understanding.