FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
learn-java/src/constructor/overload_constructor.java at master · muzammyl/learn-java · GitHub
muzammyl
/
learn-java
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
3
Code
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
learn-java
/
src
/
constructor
/
overload_constructor.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (30 loc) · 746 Bytes
Breadcrumbs
learn-java
/
src
/
constructor
/
overload_constructor.java
Copy path
File metadata and controls
32 lines (30 loc) · 746 Bytes
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
package
src
.
constructor
;
class
box4
{
double
width
,
height
,
depth
;
box4
(
double
w
,
double
h
,
double
d
) {
width
=
w
;
height
=
h
;
depth
=
d
;
}
box4
() {
width
= -
1
;
height
= -
1
;
depth
= -
1
;
}
box4
(
double
len
) {
width
=
height
=
depth
=
len
;
}
double
volume
() {
return
width
*
height
*
depth
;
}
}
class
boxDemo4
{
public
static
void
main
(
String
[]
args
) {
box4
b41
=
new
box4
(
21
,
11
,
31
);
box4
b42
=
new
box4
();
box4
cube
=
new
box4
(
6
);
System
.
out
.
println
(
"Volume b41: "
+
b41
.
volume
());
System
.
out
.
println
(
"Volume b42: "
+
b42
.
volume
());
System
.
out
.
println
(
"Volume of cube: "
+
cube
.
volume
());
}
}
Back
|
FazBrowse Home
|
New Git URL