Reply
Tue 22 May, 2012 01:03 pm
Why you put abstract as qualifier to the method that is introduced/presented in the interface and then implemented in the some implementing class? But not all methods that are presented in the interface have abstract as a qualifier, have they and why so?
for example:
public interface Varita {
public abstract String kuinkaVaritan();
}
...
(implementing class)
public class Nelio extends GeometricObject implements Varita {
private double sivu;
public Nelio(double sivu) {
this.sivu = sivu;
}
public double getSivu() {
return sivu;
}
public void setSivu(double sivu) {
this.sivu = sivu;
}
public double getArea() { // ala
return sivu*sivu;
}
public double getPerimeter() { // piiri
return 4*sivu;
}
public String kuinkaVaritan( ) {
return "Väritetään siniseksi neliöksi";
}
public String toString() {
return "NELIÖ: " + "sivu "+sivu+" "+super.toString();
}
}