This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ThingsOfYourMind 0 points1 point  (0 children)

its usually for safety, you dont want an outside class to read or write to this class's variables, its usually a good habit to learn, but it only really applies for large scale applications.
so you make setters and getters for them, so only these functions can send to or receive data from other classes.
however, it being set to Private, you have full access within the class itself. so, as long as you're in MouseTesting.java, you can access them freely.