Primitive datatypes and Autoboxing

  • Avoid creating objects(wrapper classes) unnecessary.
  • Prefer primitives.
  • Boxed types have poor performance and memory issues. It may also lead to NPE’s.
  • Read this for Java primitives vs Objects comparison and measuring their performance – https://www.baeldung.com/java-primitives-vs-objects