import java.lang.*;
import java.lang.reflect.*;

class Reflection
{
    private int fielda;
    private float fieldb;
    private String fieldc;
    Reflection()
    {
       fielda = 0;
       fieldb = 0;
       fieldc = "";
    }
    Reflection(int a, float b, String c)
    {
        fielda = a;
        fieldb = b;
        fieldc = c;
        return;
    }
    int getfielda()
    {
        return fielda;
    }
    float getfieldb()
    {
        return fieldb;
    }
    String getfieldc()
    {
        return fieldc;
    }
    int add(int a)
    {
        return a + fielda;
    }
    float add(float b)
    {
        return b + fieldb;
    }
    String add(String c)
    {
        return c + fieldc;
    }
    void Reflect()
    {
        try
        {
            System.out.println("> " + this.getClass().getName() + " metody");
            Method methods [] = this.getClass().getMethods();
            for(int i = 0; i < methods.length; i++)
            {
                System.out.print("   " + methods[i].getReturnType() + " " + methods[i].getName());
                Class  p [] = methods[i].getParameterTypes();
                System.out.print("(");
                for(int j = 0; j < p.length; j++)
                    if(j != p.length - 1)
                        System.out.print(p[j] + ", ");
                   else
                        System.out.print(p[j]);
                System.out.println(") ");
            }
            System.out.println("> " + this.getClass().getName() + " zadeklarowane metody");
            methods = this.getClass().getDeclaredMethods();
            for(int i = 0; i < methods.length; i++)
            {
                System.out.print("   " + methods[i].getReturnType() + " " + methods[i].getName());
                Class  p [] = methods[i].getParameterTypes();
                System.out.print("(");
                for(int j = 0; j < p.length; j++)
                    if(j != p.length - 1)
                        System.out.print(p[j] + ", ");
                   else
                        System.out.print(p[j]);
                System.out.println(") ");
            }
            System.out.println("> " + this.getClass().getName() + " konstruktory");
            Constructor constructors [] = this.getClass().getConstructors();
            for(int i = 0; i < constructors.length; i++)
            {
                System.out.print("   " + constructors[i].getName());
                Class  p [] = constructors[i].getParameterTypes();
                System.out.print("(");
                for(int j = 0; j < p.length; j++)
                    if(j != p.length - 1)
                        System.out.print(p[j] + ", ");
                   else
                        System.out.print(p[j]);
                System.out.println(") ");
            }
            System.out.println("> " + this.getClass().getName() + " zadeklarowane konstruktory");
            constructors = this.getClass().getDeclaredConstructors();
            for(int i = 0; i < constructors.length; i++)
            {
                System.out.print("   " + constructors[i].getName());
                Class  p [] = constructors[i].getParameterTypes();
                System.out.print("(");
                for(int j = 0; j < p.length; j++)
                    if(j != p.length - 1)
                        System.out.print(p[j] + ", ");
                   else
                        System.out.print(p[j]);
                System.out.println(") ");
            }
            System.out.println("> " + this.getClass().getName() + " pola");
            Field fields [] = this.getClass().getFields();
            for(int i = 0; i < fields.length; i++)
            {
                System.out.println("   " + fields[i].getType() + " " + fields[i].getName());
            }
            System.out.println("> " + this.getClass().getName() + " zadeklarowane pola");
            fields = this.getClass().getDeclaredFields();
            for(int i = 0; i < fields.length; i++)
            {
                System.out.println("   " + fields[i].getType() + " " + fields[i].getName());
            }
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
        }
    }
    public static void main(String[] args)
    {
        Reflection r = new Reflection(1, 2F, "To jest test");
        r.Reflect();
    }
}
