Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The relative merits of the reflection

Name: Anonymous 2010-11-11 12:46


// Without reflection
Foo foo = new Foo();
foo.hello();


Well, now that was lame as fuck.

_______________________________________________


// With reflection
Class cls = Class.forName("Foo");
Object foo = cls.newInstance();
Method method = cls.getMethod("hello", null);
method.invoke(foo, null);


Now that's what I call elegant!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List