Created
May 27, 2012 19:37
-
-
Save olekhy/2815620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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