Access specifiers: public and private data and methods

Instance variables of an object can be accessed using dot notation, just like in Python, Javascript, or C++. Here’s the simple example of defining a Circle class, which allows Circle objects to be created. Each circle object has the instance variables x, y, and r:

Get hands-on with 1400+ tech skills courses.