[Java] IO class + Doagain class

Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 34
  1. #16
    Account Upgraded | Title Enabled! Generic230 is offline
    MemberRank
    Jul 2009 Join Date
    506Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    So then tell me, How would I use this in my script?
    Make a file called Main.java place my code in there, compile, run.
    Or replace
    Code:
    public class Main {
    with
    Code:
    public class IO{
    (which is what your file is called)

  2. #17
    Omega ihatehaxor is offline
    MemberRank
    Apr 2008 Join Date
    JerseyLocation
    5,461Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Generic230 View Post
    Make a file called Main.java place my code in there, compile, run.
    no not that, how would I use it in a program.

    like IO.getString
    what do you type, to use this function?

  3. #18
    Account Upgraded | Title Enabled! Generic230 is offline
    MemberRank
    Jul 2009 Join Date
    506Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    no not that, how would I use it in a program.

    like IO.getString
    what do you type, to use this function?
    It's the EXACT same as yours... I just fixed the spacing and imports...

  4. #19
    Account Upgraded | Title Enabled! MjClarke1 is offline
    MemberRank
    Jun 2006 Join Date
    London, OntarioLocation
    644Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    no not that, how would I use it in a program.

    like IO.getString
    what do you type, to use this function?
    Well because its a class, you'd probably have to

    IO test = new IO();

    test.getString() whatever the params are.

  5. #20
    Account Upgraded | Title Enabled! Generic230 is offline
    MemberRank
    Jul 2009 Join Date
    506Posts

    Re: IO class + Doagain class

    Quote Originally Posted by MjClarke1 View Post
    Well because its a class, you'd probably have to

    IO test = new IO();

    test.getString() whatever the params are.
    They're all static, just like his.
    So, IO.getString() & whatever his otehr ones are

  6. #21
    Account Upgraded | Title Enabled! MjClarke1 is offline
    MemberRank
    Jun 2006 Join Date
    London, OntarioLocation
    644Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Generic230 View Post
    They're all static, just like his.
    So, IO.getString() & whatever his otehr ones are
    Only if you public static main void(String[] args) is in the same file, if you're calling functions from a different java file you have to create the object

  7. #22
    Omega ihatehaxor is offline
    MemberRank
    Apr 2008 Join Date
    JerseyLocation
    5,461Posts

    Re: IO class + Doagain class

    wait wth, epic fail. You didn't change anything.... Trying to trick me or something? You just deleted the extra spaces..... That doesn't make any difference, wth was the point..

  8. #23
    Account Upgraded | Title Enabled! Generic230 is offline
    MemberRank
    Jul 2009 Join Date
    506Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    wait wth, epic fail. You didn't change anything.... Trying to trick me or something? You just deleted the extra spaces..... That doesn't make any difference, wth was the point..
    I already told you that, I just removed your useless imports and fixed spacing. It just makes your code neater, having messy code with bad spacing is bad practice.

    Quote Originally Posted by Generic230 View Post
    It's the EXACT same as yours... I just fixed the spacing and imports...
    ^

    Quote Originally Posted by Generic230 View Post
    I'm fixing your shitty spacing because it looks disgusting, you could check for any other changes, and I removed your useless imports, or do you not understand english?



    He's been coding Java(learning from school loool) for maybe a week, and decided he is better than anyone else.
    ^
    Last edited by Generic230; 21-10-09 at 02:26 AM.

  9. #24
    Omega ihatehaxor is offline
    MemberRank
    Apr 2008 Join Date
    JerseyLocation
    5,461Posts

    Re: IO class + Doagain class

    Dude, this is just a class. You don't ever have to even use this code again.. So who cares if there are extra spaces. As long as it works, thats all it matters...

  10. #25
    Account Upgraded | Title Enabled! MjClarke1 is offline
    MemberRank
    Jun 2006 Join Date
    London, OntarioLocation
    644Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    Dude, this is just a class. You don't ever have to even use this code again.. So who cares if there are extra spaces. As long as it works, thats all it matters...
    It's just proper programming practice, if you always write messy code, you'll stay in that mindset and always write messy code.

    If you use proper spacing etc.. you'll always do it properly as you practice

  11. #26
    Omega ihatehaxor is offline
    MemberRank
    Apr 2008 Join Date
    JerseyLocation
    5,461Posts

    Re: IO class + Doagain class

    In Dr.Java, it can already properly space it for me.
    Just do ctrl + a
    and click on tab.

  12. #27
    Account Upgraded | Title Enabled! Generic230 is offline
    MemberRank
    Jul 2009 Join Date
    506Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    Dude, this is just a class. You don't ever have to even use this code again.. So who cares if there are extra spaces. As long as it works, thats all it matters...
    Code:
        public static int getInt(String str) {
            try {
                try {
                    try {
                        try {
                            try {
                                try {
                                    try {
                                        try {
                                            try {
                                                try {
                                                    try {
                                                        try {
                                                            try {
                                                                try {
                                                                    try {
                                                                        try {
                                                                            try {
                                                                                try {
                                                                                    try {
                                                                                        try {
                                                                                            try {
                                                                                                try {
                                                                                                    try {
                                                                                                        try {
                                                                                                            try {
                                                                                                                return Integer.parseInt(str);
                                                                                                            } catch (NumberFormatException e) {
                                                                                                                e.printStackTrace();
                                                                                                            }
                                                                                                        } catch (NumberFormatException e) {
                                                                                                            e.printStackTrace();
                                                                                                        }
                                                                                                    } catch (NumberFormatException e) {
                                                                                                        e.printStackTrace();
                                                                                                    }
                                                                                                } catch (NumberFormatException e) {
                                                                                                    e.printStackTrace();
                                                                                                }
                                                                                            } catch (NumberFormatException e) {
                                                                                                e.printStackTrace();
                                                                                            }
                                                                                        } catch (NumberFormatException e) {
                                                                                            e.printStackTrace();
                                                                                        }
                                                                                    } catch (NumberFormatException e) {
                                                                                        e.printStackTrace();
                                                                                    }
                                                                                } catch (NumberFormatException e) {
                                                                                    e.printStackTrace();
                                                                                }
                                                                            } catch (NumberFormatException e) {
                                                                                e.printStackTrace();
                                                                            }
                                                                        } catch (NumberFormatException e) {
                                                                            e.printStackTrace();
                                                                        }
                                                                    } catch (NumberFormatException e) {
                                                                        e.printStackTrace();
                                                                    }
                                                                } catch (NumberFormatException e) {
                                                                    e.printStackTrace();
                                                                }
                                                            } catch (NumberFormatException e) {
                                                                e.printStackTrace();
                                                            }
                                                        } catch (NumberFormatException e) {
                                                            e.printStackTrace();
                                                        }
                                                    } catch (NumberFormatException e) {
                                                        e.printStackTrace();
                                                    }
                                                } catch (NumberFormatException e) {
                                                    e.printStackTrace();
                                                }
                                            } catch (NumberFormatException e) {
                                                e.printStackTrace();
                                            }
                                        } catch (NumberFormatException e) {
                                            e.printStackTrace();
                                        }
                                    } catch (NumberFormatException e) {
                                        e.printStackTrace();
                                    }
                                } catch (NumberFormatException e) {
                                    e.printStackTrace();
                                }
                            } catch (NumberFormatException e) {
                                e.printStackTrace();
                            }
                        } catch (NumberFormatException e) {
                            e.printStackTrace();
                        }
                    } catch (NumberFormatException e) {
                        e.printStackTrace();
                    }
                } catch (NumberFormatException e) {
                    e.printStackTrace();
                }
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
            return 0;
        }

  13. #28
    Account Upgraded | Title Enabled! BBim is offline
    MemberRank
    Sep 2008 Join Date
    127.0.0.1Location
    1,110Posts

    Re: IO class + Doagain class

    Quote Originally Posted by Ace View Post
    Dude, this is just a class. You don't ever have to even use this code again.. So who cares if there are extra spaces. As long as it works, thats all it matters...
    Well, first its practice, if you use bad coding practice on one file, you might use it on another.

    Second if you ever need to review that file or implement something else, it will take more time to do(probably just some seconds lol).

    Third people wont just copy/paste what you posted, they will try to understand it before use, so using proper programming practice is better.
    ---------
    On a side note, man, calm down, accept what people say or dont post it, dont expect everyone to say "I loved it, thanks" because this is very hard to get.
    Also you started the flamming on your own thread :\

  14. #29
    Account Upgraded | Title Enabled! PinkGatsby is offline
    MemberRank
    Mar 2009 Join Date
    AmericaLocation
    434Posts

    Re: IO class + Doagain class

    Just some tips
    - allow the method to throw the exception and catch up where it's called.
    - Don't use JOptionPane.showinputdialog for getting a yes/no answer, use showOptionDialog.
    - Why bother using compareTo when you can do equals
    -
    Code:
    String word; 
        word = IO.getString("Enter word") ;
    You should learn to instantaneously create a variable and set a value to it
    - Why do we have system.out.println() everywhere.. Use logger and set the logging level to finest if you want to debug the class so other people using your class won't have to see all the things you're printing to the screen (im assuming you want to debug it o__o)
    - Assuming you want to make DoAgain Singleton
    public Doagain(){}
    Should be private
    - Your println method is redundant.

  15. #30
    Omega ihatehaxor is offline
    MemberRank
    Apr 2008 Join Date
    JerseyLocation
    5,461Posts

    Re: IO class + Doagain class

    Okay I found out how to do the Do command.
    Goodluck~



Page 2 of 3 FirstFirst 123 LastLast

Advertisement