001package horstmann.ch07_reflect1;
002import java.io.PrintStream;
003import java.lang.reflect.InvocationTargetException;
004import java.lang.reflect.Method;
005
006/**
007   This program prints "Hello, World" the hard way,
008   using reflection.
009 */
010public class HardHello
011{
012        public static void main(String[] args)
013                        throws NoSuchMethodException, IllegalAccessException,
014                        InvocationTargetException
015        {
016                Method m = PrintStream.class.getDeclaredMethod(
017                                "println", String.class);
018                m.invoke(System.out, "Hello, World!");
019        }
020}
021