in netbeans 6.7 i'm trying to create a text file,say man.txt
using code "file fr=new file("man.txt")..
code executed fine..but i can't see the file man.txt anywhere

where the file is created..pls help me

you try this

file f=new file("C:\\Location\\filename.txt")

>code executed fine..but i can't see the file man.txt anywhere..

Correct me if I am wrong. OP wants to create a file using java.io.File class. There are two instance methods namely - createNewFile() and createTempFile() which create a file.

Following code creates a new File instance by converting the given pathname string into an abstract pathname.

File f=new File("man.txt");

The File class is "An abstract representation of file and directory pathnames." (Java API ref). Just because you have an an abstract representation of a file name, that doesn't mean you necessarily have an actual file on disk. The actual file will appear when you open some kind of output stream to the File and write something.
Alternatively you can use the afore-mentioned createNewFile() to create an actual empty file on disk (createTempFile() is different, it's a static factory method).

thanxx to all...expect many more questions .i'm just an amture..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.