Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7b5b02

Browse files
authored
Method Overriding add folder
1 parentd0bb52b commita7b5b02

File tree

1 file changed

+33
-0
lines changed
  • Inheritance and Polymorphism/Method Overriding

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
classNoodle {
2+
3+
protecteddoublelengthInCentimeters;
4+
protecteddoublewidthInCentimeters;
5+
protectedStringshape;
6+
protectedStringingredients;
7+
protectedStringtexture ="brittle";
8+
9+
Noodle(doublelenInCent,doublewthInCent,Stringshp,Stringingr) {
10+
11+
this.lengthInCentimeters =lenInCent;
12+
this.widthInCentimeters =wthInCent;
13+
this.shape =shp;
14+
this.ingredients =ingr;
15+
16+
}
17+
18+
publicvoidcook() {
19+
20+
System.out.println("Boiling.");
21+
22+
this.texture ="cooked";
23+
24+
}
25+
26+
publicstaticvoidmain(String[]args) {
27+
28+
Spaetzlekaesespaetzle =newSpaetzle();
29+
kaesespaetzle.cook();
30+
31+
}
32+
33+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp