package com.logicbig.example.field;
import java.lang.reflect.Field;
public class GetByteExample {
private static byte aStaticByte = 2;
private byte aByte;
public GetByteExample(byte aByte) {
this.aByte = aByte;
}
public static void main(String... args) throws NoSuchFieldException, IllegalAccessException {
GetByteExample obj = new GetByteExample((byte) 10);
Field field = obj.getClass().getDeclaredField("aByte");
byte aByte = field.getByte(obj);
System.out.println(aByte);
Field field2 = GetByteExample.class.getDeclaredField("aStaticByte");
byte aByte2 = field2.getByte(null);
System.out.println(aByte2);
}
}