Question

I know this is very basic question but please read the full question first. Its bit confusing for me so I need all your help. We know that there are two ways of creating an object in java.

  • use of "new" keyword and
  • class.forName().

But I came across some other ways also in a book to create an object which I am not able to understand. The keywords are

  • newarray
  • anewarray
  • multianewarray

I am not getting any good study meterial on internet for these keywords. Please help me out. I am posting the link here. Please read the first 2 lines. http://www.artima.com/insidejvm/ed2/gcP.html

Was it helpful?

Solution

These are not keywords: these are JVM bytecode instructions.

E.g. Java code new int [3][2] compiles into these bytecodes:

iconst_3
iconst_2
multianewarray [[I 2
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top