Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-809 Topic 16 Question 46 Discussion

Actual exam question for Oracle's 1Z0-809 exam
Question #: 46
Topic #: 16
[All 1Z0-809 Questions]

Given the code fragment:

Path p1 = Paths.get(''/Pics/MyPic.jpeg'');

System.out.println (p1.getNameCount() +

'':'' + p1.getName(1) +

'':'' + p1.getFileName());

Assume that the Pics directory does NOT exist.

What is the result?

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Arlie
1 months ago
If the Pics directory doesn't exist, maybe the code will just create a new one called 'Pics_2' and call it a day. That's how it works, right? *wink wink*
upvoted 0 times
...
Leonora
1 months ago
Oh, I know this one! It's gotta be A. If the directory doesn't exist, the Paths.get() method is going to throw an exception, no doubt about it. I'm feeling pretty confident about this one.
upvoted 0 times
Paz
12 days ago
I'm not so sure, I think it might be B instead.
upvoted 0 times
...
Louann
14 days ago
I think you're right, A seems like the correct answer.
upvoted 0 times
...
...
Mira
1 months ago
Hold on, if the directory doesn't exist, wouldn't it just print the file name? I'm going to go with D - 2:Pics: MyPic.jpeg. Seems like the most logical answer to me.
upvoted 0 times
Lawrence
9 days ago
Great, let's go with D then. 2:Pics: MyPic.jpeg.
upvoted 0 times
...
Halina
10 days ago
Yeah, I agree. It makes sense that it would just print the file name if the directory doesn't exist.
upvoted 0 times
...
Johnna
14 days ago
I think you're right, D does seem like the most logical answer.
upvoted 0 times
...
...
Lilli
2 months ago
Hmm, I'm not too sure about this one. If the directory doesn't exist, I'm guessing it might try to create it or something. Let's see, maybe B is the answer? 2:MyPic.jpeg: MyPic.jpeg sounds about right.
upvoted 0 times
Audry
2 days ago
User3: I'm not sure, but I think B) sounds correct.
upvoted 0 times
...
Ressie
15 days ago
I'm not sure either, but I agree with B. 2:MyPic.jpeg: MyPic.jpeg
upvoted 0 times
...
Vicky
16 days ago
User2: No, I believe it's B) 2:MyPic.jpeg: MyPic.jpeg
upvoted 0 times
...
Felix
1 months ago
User1: I think it might be A) An exception is thrown at run time.
upvoted 0 times
...
Trinidad
1 months ago
No, I believe it will throw an exception at runtime.
upvoted 0 times
...
Micheal
1 months ago
I think B is correct. It should be 2:MyPic.jpeg: MyPic.jpeg
upvoted 0 times
...
...
Bok
2 months ago
I agree with Dorothea, the correct answer is D) 2:Pics: MyPic.jpeg due to the directory not existing.
upvoted 0 times
...
Dorothea
2 months ago
I believe the answer is D) 2:Pics: MyPic.jpeg because the directory Pics does not exist.
upvoted 0 times
...
Lawrence
2 months ago
I think the answer is A) An exception is thrown at run time.
upvoted 0 times
...
Rory
2 months ago
I agree with Yun, the correct answer is D) 2:Pics: MyPic.jpeg due to the directory not existing.
upvoted 0 times
...
Yun
2 months ago
I believe the answer is D) 2:Pics: MyPic.jpeg because the directory Pics does not exist.
upvoted 0 times
...
King
2 months ago
I think the answer is A) An exception is thrown at run time.
upvoted 0 times
...
Dustin
2 months ago
Well, this is a tricky one. I'm going to go with A - an exception is thrown at run time. The Paths.get() method requires the directory to exist, so if it doesn't, it's going to throw an exception. Let's see how it plays out!
upvoted 0 times
Colene
14 days ago
The correct answer is D) 2:Pics: MyPic.jpeg
upvoted 0 times
...
Lucy
15 days ago
I agree with A) An exception is thrown at run time.
upvoted 0 times
...
Carey
16 days ago
I'm not sure, but I'll go with C) 1:Pics:/Pics/ MyPic.jpeg
upvoted 0 times
...
Alethea
2 months ago
I think it's B) 2:MyPic.jpeg: MyPic.jpeg
upvoted 0 times
...
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77