Java initially was designed for object-oriented programming. So it has most OOP features. Learn more about OOP if you know nothing about it.
In Java, classes themselves are special objects that are stored in a separate memory area called the method area. Instances of classes are stored in a memory area called heap. In both cases, if the JVM can't satisfy the memory allocation request, a OutOfMemoryError exception will be thrown.