Hey Sonu,

1)  FileOutputStream throws a FileNotFoundException which must be
handled.  The easiest way to do this is to surround it in a try/catch
block.
2)  The save() method takes two arguments, save(OutputStream out,
String comments).

I don't quite follow what you're trying to do with the save. But the
following will compile and run.  Hope this helps!
Jason

package myownproject;
import java.util.*;
import java.io.*;
public class MyOwnProject {
    public MyOwnProject(){}
    public static void main(String[] args) {
      try{
          FileOutputStream pr = new FileOutputStream("my.txt");
          Properties p= new Properties(System.getProperties());
          p.save(pr,"hello");
      } catch (FileNotFoundException e) {
          System.out.println("Can't find the specified file");
      }
   }
}

On Jul 10, 5:32 am, Sonu Mittal <[email protected]> wrote:
> hey somebody help me. tell me whats the error in the code. When i
> compile the code, it says File io exception must be held. second error
> it gives is method save cant be applied to given types. I just want to
> save java run time proerties in a file. plz help me.....
>
> package myownproject;
> import java.util.*;
> import java.io.*;
> public class MyOwnProject {
>     public MyOwnProject(){}
>     public static void main(String[] args) {
>        FileOutputStream pr = new FileOutputStream("my.txt");
>        Properties p= new Properties(System.getProperties());
>        p.save(pr);
>     }
>
>
>
> }

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to