I just write a program which contains a self-defined class---Event. It has 5 variable member with get and set method. Code is here.
public class Event {
private String CaseID;
private String Activity;
private int StartTime;
private int CompleteTime;
private String Notes;
}
Now I am confused because every object of Event class takes 32 Bytes in the IDE profiler result. But actually it should be larger than that. Every String object takes at least 18 bytes in my computer. I think you may not trust the calculation of string object so I add a link which contains the explanation. Memory usage of String in Java.