package com.valami;
public class Ferrari
{
private int v = 0;
private void alam()
{
System.out.println(\"alam\");
}
public Ferrari()
{
System
Classes can access the private instance variables of (other) objects of the same type.
The following is also possible
public class Foo {
private int a;
public void mutateOtherInstance(Foo otherFoo) {
otherFoo.a = 1;
}
}
You could argue if this is desirably or not, but it's just a rule of life that the JLS has specified this is legal.