Explicitly and without apology a marketing vehicle MaryMaryQuiteContrary

Friday Jul 02, 2004

Time to play Friday Free Stuff*.

(but we gotta be quick because I need to get to the airport)

This week Friday Free Stuff* is sponsored by SDN and the lovely and talented Bao, who we see here showcasing today's prizes* .....

One of you lucky readers will win*.....

This MIDP Style Guide (signed by Bao; she's not the author but I made her sign it because I knew you guys might want to sell the book on ebay after you read it and having Bao's signature on it will seriously bring in the bids for you....)

as well as this gorgeous t-shirt that has been signed by Tim Lindholm (!!!!!) and Bao (!!!!!!!!!!)

 

and these fabulous prizes* go to the person who most correctly or in some other arbitrary way answers this:

 Which of the following Java expressions *isn't* a compile-time constant:

(a) 0
(b) false
(c) null
(d) "nada"
(e) "na" + "da"
(f) 0.0
(g) 0L
(h) 0.0f

Post your answers in the comments section of this blog entry.

Question once again courtesy of Dr. Josh of that famous Click and Hack team. (he's gotten all kinds of awards during JavaOne, you know... he wasn't really singing karaoke... he won an award for best Spec lead.... i was just being silly...)

So big things you need to know

1. *Friday Free Stuff is not a contest. It is me giving something away that I personally own to somebody I choose. I pay for shipping with stamps that I buy at the post office. Sun employees can play but are not eligible to win the prize. I am the judge. My decisions are final.

2. You need to get it on if you want to win the prize because I go on hiatus beginning next week and we're going to award Friday Free Stuff (if we have a winner before Saturday) before I leave.

3. I like it when you join SDN. Bao likes it too.

bon weekend!!

mary

*see item number 1 above.

Comments:

The answer is (e) since the JVM creates two StringBuffer objects to perform the concatenation.

Posted by Bruce Hopkins on July 02, 2004 at 07:11 AM PDT #

Hmm.. I think they all are constant expressions, even (e). A constant expression can include concatenation of strings. For instance, the JLS gives this as an example of a constant expression: "The integer " + Long.MAX_VALUE + " is mighty big."

Posted by Paul on July 02, 2004 at 07:24 AM PDT #

I think strings contants are concatenated at compile time. So, I say (f) isn't a constant expression. Because of floating point inaccuracy or some such similar reason that only apply to doubles.

Posted by Sten on July 02, 2004 at 07:29 AM PDT #

They are all compile-time constants. Note that the java language specification was later amended to include null as a compile-time constant. If you ignore that amendments then null (c) is the answer you are looking for.

Posted by Nadeem on July 02, 2004 at 11:04 AM PDT #

They are all compile-time constants. Note that the java language specification was later amended to include null as a compile-time constant. If you ignore that amendments then null (c) is the answer you are looking for.

Posted by Nadeem on July 02, 2004 at 11:09 AM PDT #

They are all compile-time constants. Note that the java language specification was later amended to include null as a compile-time constant. If you ignore that amendments then null (c) is the answer you are looking for.

Posted by Nadeem on July 02, 2004 at 11:10 AM PDT #

and Nadeem is our "winner!" his "prize" is on his way to him as we "speak." Thank you for playing Friday Free Stuff! mary p.s. remember it's not a contest; i am giving Nadeem stuff i personally own and am shipping it to him with stamps that i bought at the post office.

Posted by mary on July 04, 2004 at 10:09 AM PDT #

Hi, The solution to the problem is not in the answer set. I mean, all the suggested answers are compile time constants. so none of them are non-compile time constants. How do i prove my point??? I used the "javap" command (disassembler) to analyse the compiled class file. All the probable answers are compile-time constants including ("java" + "one" => "javaone", which is due to static-type analysis). So, in short my answer is none of the suggested answers ;-) ( A Big Smile) <<< Manjunath >>>

Posted by Manjunath on July 09, 2004 at 05:51 AM PDT #

Hi, The solution to the problem is not in the answer set. I mean, all the suggested answers are compile time constants. so none of them are non-compile time constants. How do i prove my point??? I used the "javap" command (disassembler) to analyse the compiled class file. All the probable answers are compile-time constants including ("java" + "one" => "javaone", which is due to static-type analysis). So, in short my answer is none of the suggested answers ;-) ( A Big Smile) <<< Manjunath >>>

Posted by Manjunath on July 09, 2004 at 05:57 AM PDT #

Hi, The solution to the problem is not in the answer set. I mean, all the suggested answers are compile time constants. so none of them are non-compile time constants. How do i prove my point??? I used the "javap" command (disassembler) to analyse the compiled class file. All the probable answers are compile-time constants including ("java" + "one" => "javaone", which is due to static-type analysis). So, in short my answer is none of the suggested answers ;-) ( A Big Smile) <<< Manjunath >>>

Posted by Manjunath on July 09, 2004 at 05:58 AM PDT #

0.0f Please done ask me the reason :)

Posted by Goldy on July 21, 2004 at 03:20 AM PDT #

Post a Comment:
Comments are closed for this entry.