I have an incredibly basic question, but searching for it in the docs has done me no good, probably because I don’t know what i’m searching for. I’ve actually completed several programs but never used this notation i’m finding in quite a few code examples I’ve been researching.
Up until now, when I’ve instantiated a class I’ve basically done the following:
public ClassType mclassname;
mclassname = new ClassType();
But I’ve seen this used:
public ClassType _mclassname;
__mclassname = new VortexView();
I can’t find the documentation for the difference in the 2, but I’m thinking that it has something to do with making multiple instances of the object impossible?
If you know what I should look for to figure this out myself, that would be sufficient.
I just can’t find it in the documents for instantiating classes.
Nested classes can be declaredprivatewhcih means they can only be used as a type inside the enclosing class.Prefixing the names of class members with underscores has no syntactic meaning. It is a convention from C++ (and Python where it’s specifically used to mark private members) that is not generally used in Java, but not uncommon among programmers who are more familiar with C++ or Python.