An access modifier controls which parts of your code can see a field or method. The you'll use most are public and private.
public means any code, anywhere, can access it. private means only code inside the same class can access it.
class BankAccount {
private double balance;
public String ownerName;
}
Outside the class, you can read account.ownerName freely. But account.balance causes a compile error because balance is private. This restriction is intentional. You control access to sensitive data by choosing the right modifier.