JVM Knowledge

Although both class instances and arrays are objects, the Java Virtual Machine creates and manipulates class instances and arrays using distinct sets of instructions:

  • Create a new class instance: new.
  • Create a new array: newarray, anewarray, multianewarray.
  • Access fields of classes (static fields, known as class variables) and fields of class instances (non-static fields, known as instance variables): getstatic, putstatic, getfield, putfield.
  • Load an array component onto the operand stack: baload, caload, saload, iaload, laload, faload, daload, aaload.
  • Store a value from the operand stack as an array component: bastore, castore, sastore, iastore, lastore, fastore, dastore, aastore.
  • Get the length of array: arraylength.
  • Check properties of class instances or arrays: instanceof, checkcast.