반응형
expends: 클래스를 상속을 받아서 넓히는 것
public class SuperClass{
public int getNb(){
//specify what must happen
return 1;
}
public int getNb2(){
//specify what must happen
return 2;
}
}
public class SubClass extends SuperClass{
//you can override the implementation
@Override
public int getNb2(){
return 3;
}
}
public interface ExampleInterface{
public void do();
public String doThis(int number);
}
public class sub implements ExampleInterface{
public void do(){
//specify what must happen
}
public String doThis(int number){
//specfiy what must happen
}
}
반응형