Most of what you've said i agree with and i should have perhaps explained somethings.
As stated in my first post, I am taking a simple task of having a console program start with a parameter OR not.
versions...
1. run program and display text (if arguments where given) to the screen and exit.
done and moved on 2. add a test to check for argument and if nothing display suitable message, then exit. Or display the argument that was given to the screen.
Done and moved on 3. use a method to do the above (namely a method to display to the screen).
Done and moved on 4. introduce file handling, test for the filename is present, if it is delete it, then create it again inserting the argument passed (write the argument to a file in a known location and filename), then read from that file the data inside to the screen, then exit.
hit a snag with i/o operation (see erros at end of post) 5. look at refining the program more (ie introduction of constructors etc).
to be done all of this was so i could take baby steps to understanding how things glue together.
I have a book here by Ivor Hilton on Beginning Java 2. Which has helped me in some understanding (and lost me on others - ps got up to end of chapter 5 defining classes then i start going glassy eyed so to speak
)
Found a tutorial that gave me this idea of this program as i kept giving up because i couldn't really relate what i was reading etc to something pratical.
So here is the Original program i had along with the errors i got notice they all refer to the fact that te datastream "variables" for reading and writing are te issue.
Errors i got generated when i compile (currently under linux but also under Windows too
dave@localhost:~$ /home/dave/jdk1.6.0/bin/javac /dos/my_project/crm/mysimpleio.java
/dos/my_project/crm/mysimpleio.java:41: non-static method ToFile(java.lang.String) cannot be referenced from a static context
ToFile(text);
^
/dos/my_project/crm/mysimpleio.java:56: non-static method FromFile(java.lang.String) cannot be referenced from a static context
FromFile(text);
^
/dos/my_project/crm/mysimpleio.java:64: cannot find symbol
symbol : variable thefileOut
location: class mysimpleio
thefileOut.write(thefilename);
^
/dos/my_project/crm/mysimpleio.java:67: cannot find symbol
symbol : variable thefileOut
location: class mysimpleio
thefileOut.close();
^
/dos/my_project/crm/mysimpleio.java:73: cannot find symbol
symbol : variable thefileIn
location: class mysimpleio
thefileIn.read(thefilename);
^
/dos/my_project/crm/mysimpleio.java:75: cannot find symbol
symbol : variable thefileIn
location: class mysimpleio
thefileIn.close();
^
6 errors
dave@localhost:~$ under linux i'm using Java 1.6.0 and windows it's 1.5
please if you can assist me with the I/O issue i think i can get the constructor bit okay (well i did so when working from the book and erros i got were mostly typo's or of that ilk.
Should i move the datastream bits down into the methods and not in the main as they are currently??
dave.
ps appreachiate the hints about moving code out to make it cleaner.