Link Details

Link 188473 thumbnail
User 1 avatar

By rick
via ncoffee.de
Published: Jun 01 2009 / 00:11

When I re-pick-up Java, after having dealt with really different programming languages in the months before, I encounter these moments of “damn-you-know-this”. So when I came back to java this time, I recorded my top five missing Java pieces.
  • 9
  • 20
  • 2981
  • 1229

Comments

Add your comment
User 361681 avatar

kjordan2001 replied ago:

1 votes Vote down Vote up Reply

Example for ternary is wrong. Should be:

int a = 5;

int b = 10;
int max = (a > b ? a : b);


They can also be nested:
int a = 5;

int b = 10;
int c = 15;
int max = (a > b ? a : b > c ? b : c);

User 282119 avatar

Rob Signorelli replied ago:

0 votes Vote down Vote up Reply

This complaint also makes it sound like most other mainstream languages don't have this operator as well with the exact same syntax. Python's the only one I can think of off the top of my head that doesn't have this or something almost exactly like it. So I'm not sure how this becomes so easy to forget if you never leave it behind...

User 193149 avatar

p3t0r replied ago:

1 votes Vote down Vote up Reply

"I now its stupid but I do sometimes forget how to get the number of command line parameters: args.length;"

really... dude...

User 297758 avatar

brisssou replied ago:

1 votes Vote down Vote up Reply

this blog entry sucks at being interesting and useful...

User 402118 avatar

pintodragon replied ago:

0 votes Vote down Vote up Reply

Example for making an int from a String is wrong as well.

String example = “1”;

int value = Integer.valueOf( example );


Should be:

String example = “1”;

int value = Integer.parseInt( example );


Integer.valueOf will return an Integer object not an int primitive.

User 306525 avatar

newton_dave replied ago:

0 votes Vote down Vote up Reply

We've had autoboxing for awhile now.

User 421911 avatar

cgnjjj replied ago:

0 votes Vote down Vote up Reply

The errors mentioned above seem to be fixed...

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.