Vlad Hatko Vlad Hatko - 5 months ago 46
Java Question

Reference to class inside static func

I have class A:

public class ClassA {
private static int staticProperty;

public static void setStaticProperty(int staticProperty) {
//this.staticProperty = staticProperty

how can I refer to class here? uncommented code doesn't work.

I can rename property, though, but I'm wondering in possibility of such referring at all.


this is an instance; you don't have an instance.

You want ClassA.staticProperty.