FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaExamples/InheritanceDemo2.java at master · alimogh/JavaExamples · GitHub
alimogh
/
JavaExamples
Public
forked from
CMPundhir/JavaExamples
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaExamples
/
InheritanceDemo2.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (68 loc) · 1.79 KB
Breadcrumbs
JavaExamples
/
InheritanceDemo2.java
Copy path
File metadata and controls
69 lines (68 loc) · 1.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
class
Car
{
int
engine
;
int
nitro
;
int
now
;
String
transMode
;
public
Car
(){
System
.
out
.
println
(
"car object created"
);
}
public
Car
(
int
engine
,
int
nitro
,
int
now
,
String
transMode
){
System
.
out
.
println
(
"car object created"
);
this
.
engine
=
engine
;
this
.
nitro
=
nitro
;
this
.
now
=
now
;
this
.
transMode
=
transMode
;
}
public
void
show
(){
System
.
out
.
println
(
"engine : "
+
engine
);
System
.
out
.
println
(
"nitro : "
+
nitro
);
System
.
out
.
println
(
"no of wheels : "
+
now
);
System
.
out
.
println
(
"transMode : "
+
transMode
);
}
}
class
Suzuki
extends
Car
{
String
color
;
int
bootSpace
;
float
mileage
;
String
musicSystem
;
boolean
hockeySticker
;
public
Suzuki
(){
super
();
System
.
out
.
println
(
""
);
}
public
Suzuki
(
int
engine
,
int
nitro
,
int
now
,
String
transMode
,
String
color
,
int
bootSpace
,
float
mileage
,
String
musicSystem
,
boolean
hockeySticker
){
super
(
engine
,
nitro
,
now
,
transMode
);
System
.
out
.
println
(
""
);
this
.
color
=
color
;
this
.
bootSpace
=
bootSpace
;
this
.
mileage
=
mileage
;
this
.
musicSystem
=
musicSystem
;
this
.
hockeySticker
=
hockeySticker
;
}
@
Override
public
void
show
(){
super
.
show
();
System
.
out
.
println
(
"color : "
+
this
.
color
);
System
.
out
.
println
(
"bootSpace : "
+
bootSpace
);
System
.
out
.
println
(
"mileage : "
+
mileage
);
System
.
out
.
println
(
"musicSystem : "
+
musicSystem
);
System
.
out
.
println
(
"hockeySticker : "
+
hockeySticker
);
}
}
class
InheritanceDemo2
{
public
static
void
main
(
String
[]
args
){
Suzuki
alto800
=
new
Suzuki
();
alto800
.
color
=
"Red"
;
alto800
.
bootSpace
=
500
;
alto800
.
mileage
=
100.0f
;
alto800
.
musicSystem
=
"Herman"
;
alto800
.
hockeySticker
=
true
;
alto800
.
engine
=
1200
;
alto800
.
nitro
=
500
;
alto800
.
now
=
6
;
alto800
.
transMode
=
"hybrid"
;
alto800
.
show
();
Suzuki
wgR
=
new
Suzuki
(
2000
,
1500
,
8
,
"Automatic"
,
"Rainbow"
,
100
,
10.0f
,
"Sony"
,
false
);
wgR
.
show
();
}
}
Back
|
FazBrowse Home
|
New Git URL