piatok 27. mája 2011

Pre zlepšenie nálady :)

Úsmevný pokus o dôkaz, že Matrix bol naprogramovaný v Jave inšpirovaný Disgruntled Bomb.
package there.is.no.spoon;

import java.lang.reflect.Field;

public class Matrix {

    static {
        dejaVu("value", "spoon", "wake up".toCharArray());
        dejaVu("count", "spoon", "wake up".length());
    }

    private static void dejaVu(String fieldName, String ref, Object value) {
        try {
            Field field = fieldName.getClass().getDeclaredField(fieldName);
            field.setAccessible(true);
            field.set(ref, value);
        } catch (Exception e) {
            // There is no spoon, wake up. :)
        }
    }

    public static void main(String... args) {

        System.out.println("spoon");
    }
}
Inšpirované: http://thedailywtf.com/Articles/Disgruntled-Bomb-Java-Edition.aspx