Skip to content

Instantly share code, notes, and snippets.

@olekhy
Created May 27, 2012 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olekhy/2815620 to your computer and use it in GitHub Desktop.
Save olekhy/2815620 to your computer and use it in GitHub Desktop.
public class WhoMayUsePrivate
{
public static void main( String[] args )
{
DiskoVergleicher m = new DiskoVergleicher();
System.out.println( m.compare( new DiskoVergleicher() ) );
}
}
class DiskoVergleicher
{
private int priv = (int) Math.random();
public boolean compare( DiskoVergleicher comp )
{
// Zugriff auf ein privates Element über comp.priv
return priv == comp.priv;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment