Isuru Buddhika wrote:On a lecture I was told that non static methods/variables exists in the object that get created in the heap while the static ones stays in the .class file that get loaded to the RAM. Is that correct?
No, that doesn't sound correct.
The difference is essentially this: For normal, non-static variables, each instance (object) of the class has its own copy. For static variables, there is only one variable, which is shared by all instances (objects) of the class. So, a non-static variable is an instance variable and a static variable is a class variable, as the Oracle tutorial explains.
Likewise for methods: non-static methods work on objects, static methods are for the whole class.
Don't worry about where in memory what variables are stored. That's not the important part of the concept to understand (and how it works exactly isn't even specified; it's up to the specific implementation of the JVM).