wwhat does this mean

hi wat do each lines mean, am i correct

publicboolean write()//write function

{

try///try catch

{

PrintWriter savefile;//creates saved file

save =new PrintWriter(filename);

save.println(genXML());//calls genXML function

save.close();

returntrue;

}

catch(Exception e){returnfalse;}

}

}

[983 byte] By [magiciana] at [2007-11-27 0:51:06]
# 1

> hi wat do each lines mean, am i correct

> >public boolean write() //write function

> try ///try catch

> {

> PrintWriter savefile; //creates saved file

> save = new PrintWriter(filename);

> save.println(genXML()); //calls genXML function

> save.close();

> return true;

> }

> catch(Exception e){ return false; }

> }

> }

>

>

No, you are not correct. Thanks for playing. Good bye.

filestreama at 2007-7-11 23:21:44 > top of Java-index,Java Essentials,Java Programming...
# 2
wat?
magiciana at 2007-7-11 23:21:44 > top of Java-index,Java Essentials,Java Programming...
# 3

Let me guess, save and savefile should have been the same variable, it's an error that two names are used?

I seriously doubt that you're getting anyone here to spell out what's in a piece of code that we don't know where comes from, even if you throw 25 Duke stars at us. Why are you asking?

OleVVa at 2007-7-11 23:21:44 > top of Java-index,Java Essentials,Java Programming...
# 4

i just want to know wwat each of the lines actually do

public boolean write() //write function

> try ///try catch

> {

> PrintWriter save; //creates saved file

> save = new PrintWriter(filename);

> save.println(genXML()); //calls genXML function

> save.close();

> return true;

> }

> catch(Exception e){ return false; }

> }

> }

>

magiciana at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 5

> wat?

I really don't understand how you could've written that snippet of code

without understanding what each line means. (or supposed to mean

in your opinion). Consequently your question doesn't make any sense

if you really don't understand what you have written yourself.

As a corollary if you didn't write that yourself how could you ask

whether or not you're correct without writing down what your

understanding of this all is?

kind regards,

Jos

JosAHa at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 6
I'm not sure about each line, but this description is incorrect anyway:try ///try catchNot "try catch" but "try". You can easily check by yourself - there is only "try" in this line.
Michael.Nazarov@sun.coma at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 7
In your code you should use a FileWriter with the PrintWrite.... but this is basic know for programming in java... take a good book about java....
maximilian.brasila at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 8

>public boolean write() //write function

A function is called a method in Java; otherwise correct.

> try ///try catch

See earlier reply.

> PrintWriter savefile; //creates saved

Incorrect. Declares a local variable.

> save.println(genXML()); //calls genXML function

Correct; additionally passes the result of the call to save.println().

Am I helping at all?

Jos has got a point: tell us what your own understanding is, it'll make the discussion a lot easier.

OleVVa at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 9
I believe my reply was the best of all, so far.I/O regards,Filestream.P.S. :-)
filestreama at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 10
> I believe my reply was the best of all, so far.t'was not! qed! so there! :-Pkind regards,Jos ;-)
JosAHa at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 11
> qed! QED? Post Hoc Ergo Propter Hoc! :)
filestreama at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 12
wwhat what do you want? why do you keep touching me?i am a medieval man!
mkoryaka at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 13
> why do you keep touching me?wait for it....I don't want anybody elseWhen I think about you I touch myselfOoh I don't want anybody else oh no, oh no, oh no
filestreama at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 14
> > qed! > > QED? Post Hoc Ergo Propter Hoc! :)quidquid latine dictum sit altum viditur
georgemca at 2007-7-11 23:21:45 > top of Java-index,Java Essentials,Java Programming...
# 15
Hoi, is het vanavond druk?
filestreama at 2007-7-21 19:53:59 > top of Java-index,Java Essentials,Java Programming...
# 16
> wwhat what do you want? why do you keep touching me?That's a rather personal question sir.kind regards,Jos ;-)
JosAHa at 2007-7-21 19:53:59 > top of Java-index,Java Essentials,Java Programming...