Probelm in Path and Paths Classes
Hi Everybody.
I'm trying to used these classes but i got an error about package.This is my sample
Code :
import java.nio.file.Paths;
public class UsingPaths {
public static void main(String args[])
{
Path path = Paths.get("C:\\30-6-2009\\Demo\\Threads"); // Microsoft Windows syntax
System.out.format("toString: %s%n", path.toString());
System.out.format("getName: %s%n", path.getName());
System.out.format("getName(0): %s%n", path.getName(0));
System.out.format("getNameCount: %d%n", path.getNameCount());
System.out.format("subpath(0,2): %d%n", path.subpath(0,2));
System.out.format("getParent: %s%n", path.getParent());
System.out.format("getRoot: %s%n", path.getRoot());
System.out.format("isHidden: %s%n", path.isHidden());
}
}
This sample actually in
Path Operations (The Java™ Tutorials > Essential Classes > Basic I/O)
How can i fix this problem.
Re: Probelm in Path and Paths Classes
Wow this is above my head, I've not started using Java 7 yet. Do you have any specific error messages, stack traces or something?
// Json
Re: Probelm in Path and Paths Classes
Hello neo_2010.
Can you please post the error you are getting..
Re: Probelm in Path and Paths Classes
What package did you put this file in? You must add the package <package name>; declaration at the top of the file.
Re: Probelm in Path and Paths Classes
Quote:
Originally Posted by
helloworld922
What package did you put this file in? You must add the package <package name>; declaration at the top of the file.
I've got a feeling this will solve your problem neo!