Top 10 in 2008
5 popular archives:
All selections are based on page views.
Best of 2008: A developer's list
JW blogger Dustin Marx names his top 10 technology events of 2008. Highlights include updates to Java SE 6, runtime support in OpenLaszlo 4.2, and the clash of the titans that occurred early in the year, when Sun acquired MySQL on the same day that Oracle announced its acquisition of BEA. No two lists are alike and it's not too late: What were your top 10 for 2008?
Also see:
November 9, 2001
What's the best way to convert a Boolean primitive to a string? Would the following work?
boolean bool = true;
String s = new Boolean(bool).toString();
s.equals("true");
Yes, your proposed code will work. However, I'm not sure I would characterize it as "the best way to convert a Boolean into
a string" as your solution creates an unnecessary extra object. You should avoid extraneous object creation because it can
slow your program down and waste memory.
Instead, take a look at the String class. In particular, consider valueOf(boolean b) -- a static method that takes a Boolean as argument and returns a string representation. So, to convert your bool variable, you can simply do the following:
String s = String.valueOf( bool );
If you're new to Java (or whenever there is a new release), take a careful look at the JDK -- you'll find it offers many hidden treasures.
For example, you will rarely need to actually instantiate Booleans yourself since the Boolean class declares two static Boolean constants: TRUE and FALSE. So whenever you need a Boolean instance, you can just do the following:
Boolean.TRUE
or
Boolean.FALSE
String class JavadocBoolean