What is the result?

Given:

What is the result?

Given:

What is the result?

A.
doc

B.
index.html

C.
an IllegalArgumentException is thrown at runtime.

D.
An InvalidPthException is thrown at runtime.

E.
Compilation fails.

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



Leave a Reply 2

Your email address will not be published. Required fields are marked *