[Solved] Initializing objects in Java without declaring a class or using a class


Java is statically typed so you can’t point a variable to an instantiated object without declaring the class.

You can create classes without a pointer but they will just be collected by the garbage collection machine unless you’re passing them to something that uses the new object you’re creating.

This is nothing in Java:

myObject = {“x”:5,”y”:10,”z”:12,”name”:”something”}

Java doesn’t know what to do with it.

solved Initializing objects in Java without declaring a class or using a class