7
Example:
// Super classe: Carro
abstract public class Carro {
String nome;
public void andar(){
// anda
}
}
// Sub classe: Fusca
public class Fusca extends Carro {
public void andar(){
super.andar();
// Faz algo a mais
}
}
// Main
public class Principal {
public static void main(String[] args) {
Carro fusca1 = new Fusca(); // 1
Fusca fusca2 = new Fusca(); // 2
}
}
I wanted to know what is the difference between instance 1 and instance 2? And one more question, which arose, which access modifier should I use in the superclass?
Reference: http://answall.com/a/25968/7210
– Jorge B.