uebungen/sources/beispieleVL/records/RechteckOhneRecords.java

29 lines
664 B
Java

package records;
public final class RechteckOhneRecords {
private final double laenge;
private final double breite;
public RechteckOhneRecords(double laenge, double breite) {
this.laenge = laenge;
this.breite = breite;
}
public static void main(String[] args) {
RechteckOhneRecords r = new RechteckOhneRecords(4, 3);
System.out.println("Fläche = " + r.laenge() * r.breite());
}
private double breite() {
// TODO Auto-generated method stub
return laenge;
}
private double laenge() {
// TODO Auto-generated method stub
return breite;
}
}