Page 1 of 1

About Question enthuware.ocpjp.v8.2.1581 :

Posted: Wed Mar 16, 2016 10:00 am
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.

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

Posted: Wed Mar 16, 2016 11:38 am
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.