H
Han
Gast
Hallo.....obwohl ich z.b. protected void method() schon oft verwendet habe weiß ich leider noch immer nicht richtig was protected eigentlich macht. Also ich mein folgende Situation:
Nun ja bei public und bei private weiß ich Bescheid was sie machen. Also private kann ich nur innerhalb der Klasse
aufrufen. public überall. Und wie schauts bei protected aus? Was bringt mir protected???
mfg,
Hannes
Code:
public class Test{
int h;
public Test(int h){
this.h = h;
}
protected void method(int g){
...irgendwas...
}
public void method2(int g){
...irgendwas...
}
private void method2(int g){
...irgendwas...
}
}
Nun ja bei public und bei private weiß ich Bescheid was sie machen. Also private kann ich nur innerhalb der Klasse
aufrufen. public überall. Und wie schauts bei protected aus? Was bringt mir protected???
mfg,
Hannes