nerdexam
Oracle

1Z0-804 · Question #64

Given: What is the result?

The correct answer is B. index.html. p.getName(int location) = returns path' name element by index/location (starts with 0) Example: path = "project//doc//index.html" p.getName(0) = project p.getName(1) = doc p.getName(2) = index.html

NIO.2

Question

Given:

What is the result?

Exhibit

1Z0-804 question #64 exhibit

Options

  • Adoc
  • Bindex.html
  • Can IllegalArgumentException is thrown at runtime.
  • DAn InvalidPthException is thrown at runtime.
  • ECompilation fails.

How the community answered

(34 responses)
  • A
    3% (1)
  • B
    76% (26)
  • C
    6% (2)
  • D
    3% (1)
  • E
    12% (4)

Explanation

p.getName(int location) = returns path' name element by index/location (starts with 0) Example: path = "project//doc//index.html" p.getName(0) = project p.getName(1) = doc p.getName(2) = index.html

Topics

#Path#getFileName#path components

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice