Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Wink System.println(new String("Hi gang!"));

    Hi gang!

    I'm Thor, Java programmer. I have some XP in JDBC, Database design/normalisation and RMI. Am I good at it? Dunnow. Can I learn something more? Yes, that's why I'm here. Can I try to help out? Yes, but mileage WILL differ.
    My next challenge is 3D programming. As of yet, I managed to get some stuff installed (did'nt even get to jot in ONE line, sigh) but am stuck on the org.j3d package that I dont get installed... oh, well...

    So far the intro, the rest should follow soon...

    so, in style I say:

    Java Code:
    public void stop()
    {
        try
           {
               System.out.println(new String("That's all folks!"));
            }
           catch(Exception e)
           {
               // oops...
           }
    }
    Thor
    Last edited by LinuxDev@Flanders; 02-15-2012 at 11:16 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: System.println(new String("Hi gang!"));

    1. System doesn't have a println(...) method.
    2. Only in the rarest of rare cases would you want to construct a new String passing a String literal as argument.
    3. The correct method for printing a line to stdout doesn't throw any Exception. The argument being a String constructed form a String literal, can't give rise to a run time Exception either.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default Re: System.println(new String("Hi gang!"));

    Hi db,

    Hey! You replied! Thanks!
    1 - yes, it's System.out.println(); I know...
    2 - I make it a point to be somewhat pedantic about this...after all, a String() is a class that requitres instancing, I learned...
    3 - Always expect the unexpected...I've met Exceptions in places they should NOT be, but then...

    Anyway, this was just an intro...but nice to have had some reaction already...

    Lookin' 4ward to this forum...

    Thor

  4. #4
    jDennis79 is offline Member
    Join Date
    Aug 2010
    Posts
    23
    Rep Power
    0

    Default Re: System.println(new String("Hi gang!"));

    Quote Originally Posted by LinuxDev@Flanders View Post
    2 - I make it a point to be somewhat pedantic about this...after all, a String() is a class that requitres instancing, I learned...
    Well, that string constant pool was created for a reason... while being pedantic and coding in clean style is basically a good idea, trying to be smarter than the Sun/Oracle developers usually isn't. :)

    However, nice idea to introduce yourself. Welcome to the forums! :)
    Last edited by jDennis79; 02-15-2012 at 11:32 PM.

  5. #5
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default Re: System.println(new String("Hi gang!"));

    Thanks JDennis79! Glad to be here...

    I'll keep the advice

    trying to be smarter than the Sun/Oracle developers usually isn't. :)
    at heart :D

    If I may, I'll try (TRY being the word here) to contribute as well as ask. But I confess that i'm not much of an expert, more of a seasoned affectionado ;) so, mileage may vary...

    Thor

  6. #6
    javin.paul is offline Member
    Join Date
    Oct 2011
    Posts
    35
    Rep Power
    0

    Default Re: System.println(new String("Hi gang!"));

    @LinuxDev@Flanders, welcome to java-forums. I like your Java introductory way :)

  7. #7
    Join Date
    Aug 2010
    Posts
    13
    Rep Power
    0

    Default Re: System.println(new String("Hi gang!"));

    Thanks javin.paul ! I wanted to reflect my deep Java passion, I guess I succeeded!

    Glad 2b aound!

    Thor
    (beginning a long weeked, wheeee)

Similar Threads

  1. Replies: 14
    Last Post: 08-07-2011, 09:25 AM
  2. System.out.println("Hi.");
    By xCiro in forum Introductions
    Replies: 1
    Last Post: 12-11-2009, 03:23 PM
  3. System.out.println("Hello Java-Forums!");
    By Arsenic in forum Introductions
    Replies: 0
    Last Post: 03-05-2009, 05:39 PM
  4. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  5. Replies: 11
    Last Post: 08-19-2008, 11:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •