Let's joint our perception

Some basic questions about java will be asked to me ;D just want to know your opinion

  1. What is class? Me: it’s just blueprint for an object so it can be created.
  2. What is object/instance? Me: the real constructed class that has same fields and methods, has state and resides on jvm memory.
  3. What is jvm? Me: java virtual machine, doh. It’s a secured area of memory that allow java app to move freely.
  4. What is heap space? Me: an allocated amount of memory for an app to use.

I think my answers quite right, dunno what they think.

Your answers are very vague and not quite right. If a class is just a blueprint, what is a static method? An instance doesn’t need to have state. The JVM is much more than a block of memory. Saying the heap is some memory provides little information.

  1. Something that defines a data type. The operations that can be done on it and possibly but not necessarily the implementation of those operations.

  2. A black box that stores the state of a data structure important to the interface defined for its type.

  3. An intermediate layer between compiled code/data and platform specific binary code/data.

  4. Global memory an application can borrow from to store objects.

  5. What is a primitive? A data type capable of storing raw data with value assignment semantics.

  6. What is an array? A collection of randomly accessible variables.

Hehe ;D thanks for your times on this silly things. Ah static methods, I should rebuild my definition now.

@Best Username Ever
4. It sounds that heap space size is specified for ALL java apps in a jvm. Are you sure it’s not for AN app? because we specify it on run parameter.

Yes, that’s the case. I spoke generally on that topic because I wanted to not be specific to any one VM. Multiple applications can run in the same VM with shared heap space or Java source code could have been compiled with something like GCJ. How the VM (if any) “rations” memory the memory is platform specific or could be tweaked.

They way that I think of classes is like factories and cars. The factor has all sorts of methods that are relevant to it and all cars it makes. Every car is an object made from that factory. The factory can specify all the attributes for the model of car it is making and can make many different models.

This helped me understand OOP really well.