Enums, Pointers, Aliasing, Garbage Collection, JVM in Java


A special DataType that allows for a variable to be one of a set of pre-defined constants. In Java, you use the enum type (short for enumeration), a special datatype introduced in Java 5 to represent such lists of predefined constants.

package springframework.guru.enumexample;
enum Days{

   public void simpleEnumExample(){
       Days day = Days.SUNDAY;
       System.out.println("Days enum is set a value: "+day);
       assertEquals(Days.valueOf("SUNDAY"), day);


Variables that store  the address of another variable in memory. In computer science, a pointer is a programming language object, whose value refers to (or “points to”) another value stored elsewhere in the computer memory using its address. A reference in Java is NOT a pointer, and Technically java doesn’t have any pointers.


Aliasing means there are multiple aliases to a location that can be updated, and these aliases have different types. In computing, aliasing describes a situation in which a data location in memory can be accessed through different symbolic names in the program.The data object can be defined once and later a programmer can define one or more equivalent aliases that will also refer to the data object.

Garbage Collection

Deallocates memory, reuse the space for something else. Helps us not run out of memory. Automatic garbage collection is the process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects.

An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object. An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed.

JVM – Java Virtual Machine

Abstruct computing machine that allows a computer to run JAVA programs. Specifications (What is required), Implementation (a program that meets these specs), Instance (an implementation in action), Byte code and compiler.

Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages and compiled to Java bytecode. The JVM is detailed by a specification that formally describes what is required of a JVM implementation. Having a specification ensures interoperability of Java programs across different implementations so that program authors using the Java Development Kit (JDK) need not worry about idiosyncrasies of the underlying hardware platform.




Leave a Reply