Results 1 to 7 of 7
- 02-15-2012, 11:39 AM #1
Member
- Join Date
- Aug 2010
- Posts
- 13
- Rep Power
- 0
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:
ThorJava Code:public void stop() { try { System.out.println(new String("That's all folks!")); } catch(Exception e) { // oops... } }Last edited by LinuxDev@Flanders; 02-15-2012 at 11:16 PM.
- 02-15-2012, 12:14 PM #2
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 02-15-2012, 11:21 PM #3
Member
- Join Date
- Aug 2010
- Posts
- 13
- Rep Power
- 0
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....gif)
Thor
- 02-15-2012, 11:30 PM #4
Member
- Join Date
- Aug 2010
- Posts
- 23
- Rep Power
- 0
Re: System.println(new String("Hi gang!"));
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.
- 02-16-2012, 11:37 AM #5
Member
- Join Date
- Aug 2010
- Posts
- 13
- Rep Power
- 0
Re: System.println(new String("Hi gang!"));
Thanks JDennis79! Glad to be here...
I'll keep the advice
at heart :Dtrying to be smarter than the Sun/Oracle developers usually isn't. :)
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
- 02-18-2012, 07:18 AM #6
Member
- Join Date
- Oct 2011
- Posts
- 33
- Rep Power
- 0
Re: System.println(new String("Hi gang!"));
@LinuxDev@Flanders, welcome to java-forums. I like your Java introductory way :)
- 02-18-2012, 09:28 AM #7
Member
- Join Date
- Aug 2010
- Posts
- 13
- Rep Power
- 0
Similar Threads
-
(i%5=0)?System.out.println():System.out.print(" "); does not work!
By oszc in forum New To JavaReplies: 14Last Post: 08-07-2011, 09:25 AM -
System.out.println("Hi.");
By xCiro in forum IntroductionsReplies: 1Last Post: 12-11-2009, 03:23 PM -
System.out.println("Hello Java-Forums!");
By Arsenic in forum IntroductionsReplies: 0Last Post: 03-05-2009, 05:39 PM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
[SOLVED] HELP! Is this BUG? System.out.println() always shows "@9304b1"
By dark_cybernetics in forum New To JavaReplies: 11Last Post: 08-19-2008, 11:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
.gif)

Bookmarks