Skip to content

Latest commit

 

History

History
61 lines (56 loc) · 1.49 KB

08_memory_boxed_vs_primitive.adoc

File metadata and controls

61 lines (56 loc) · 1.49 KB

Memory Cost - Boxed vs. Primitive


class MinMaxPrimitivesBoxed
{
    private Boolean trueValue;
    private Boolean falseValue;
    private Byte minbyteValue;
    private Byte maxbyteValue;
    private Character minCharValue;
    private Character maxCharValue;
    private Short minShortValue;
    private Short maxShortValue;
    private Integer minIntValue;
    private Integer maxIntValue;
    private Float minFloatValue;
    private Float maxFloatValue;
    private Long minLongValue;
    private Long maxLongValue;
    private Double minDoubleValue;
    private Double maxDoubleValue;
}
class MinMaxPrimitivesPlain
{
    private boolean trueValue;
    private boolean falseValue;
    private byte minbyteValue;
    private byte maxbyteValue;
    private char minCharValue;
    private char maxCharValue;
    private short minShortValue;
    private short maxShortValue;
    private int minIntValue;
    private int maxIntValue;
    private float minFloatValue;
    private float maxFloatValue;
    private long minLongValue;
    private long maxLongValue;
    private double minDoubleValue;
    private double maxDoubleValue;
}
  • Question: What is the difference between these two classes?