About Question enthuware.ocpjp.v8.2.1581 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
rvt1234
Posts: 10
Joined: Mon Aug 18, 2014 5:25 am
Contact:

About Question enthuware.ocpjp.v8.2.1581 :

Post by rvt1234 »

As a unix user,
how would you recommend doing tests on the NIO questions and gaining experience to do the final exam?

For me this examples:

Code: Select all

        
  Path p1 = Paths.get("c:\\finance\\data\\reports\\daily\\pnl.txt");
  System.out.println(p1.subpath(0, 2));
trows:

Code: Select all

Exception in thread "main" java.lang.IllegalArgumentException
	at sun.nio.fs.UnixPath.subpath(UnixPath.java:348)
	at sun.nio.fs.UnixPath.subpath(UnixPath.java:43)
	at com.company.Main.main(Main.java:192)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Apparently the answer should have been : finance\data

All examples seems to assume a so called 'C' drive but I don't think I have any way to test it.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1581 :

Post by admin »

Well, you may simply change "c:\\finance\\data\\reports\\daily\\pnl.txt" to "/user/home/finance/data/reports/daily/pnl.txt" assuming that /user/home is your home directory. If your home directory is something else, you can use that instead of /user/home

HTH,
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests