Vinicius Souza wrote:Its weird because my Actor class is on the same package com.xcretor and the method getX() is coderanch.
Yes, but this is about the getY method, not the getX method.
And looking at your code, the getX and getY methods are not coderanch, they have default access.
You're writing in a kind of C++-style. Specifying access specifiers in Java does not work the same as in C++. Look at this:
Do you understand what's happening here? Only the variable
x has
private access. All the other variables have default access. The indentation you've used is misleading - as if all the variables are private. This is the same as:
You are doing the same with the constructor and methods:
The constructor is coderanch, but all the methods have default access.
You have to specify
private or
public for all variables and methods separately.