Wednesday, July 15, 2009

Puzzle 41 - Solution

TheMalkolm hits the nail on the head with his comment--> "Main idea to place output statement to if (or while) clause."

Also since System.out.println does not return any value (return type is void) it cannot be placed in the if clause, we need to use an alternate method of the System.out like printf().

package com.twister;
class GroovyStyle{/*class name inspired by Yauheni*/
public static void main(java.lang.String[] args){

if(null==System.out.printf("Hello world",(Object[])null)){}

@Sebastian- Seems that there is a problem with word verification on Firefox 3.5. Hopefully someone at Google fixes it soon. I have currently disabled the word verification process - that should makes things easier for you folks. Now I just need to keep my fingers crossed that I don't end up with spam comments :)!

No comments:

Post a Comment

Solution for this question?