Sunday, May 3, 2009

Puzzle 21 – Static This!

Language – Java | Type – Concept | Last date 06-May-2009 9:00 p.m. IST | Points 2

Does anyone really code like this? Anyone out here figure out what does this code do?
package com.twisters;
public class StaticThis {

public static void main(String[] args) {
new StaticThis().print();
}

public static void printStatement(){
System.out.println("Static Method Print Statement called.");
}

public void print() {
this.printStatement();
}
}
Got an answer? Why don’t you leave it here.

1 comment:

  1. Perhaps the goggles do something, since I don't see a puzzle here. (It *might* be an time worn puzzle if you had used a null reference to call the static).

    Here is a old toughy of mine (at least that's a real puzzle!): http://code-o-matic.blogspot.com/2009/02/crazy-java-puzzler.html

    ReplyDelete

Solution for this question?