w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Calling public "non-static" variable or method without instantiating its class

In Java, there is no way to call non static variables, i.e instance members without instance.

There is a reason for that, from Understanding Instance and Class Members

When a number of objects are created from the same class blueprint, they each have their own distinct copies of instance variables.

Where as static methods belongs to Class not to the specific instance

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.