FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
basic-programs/java/Overload.java at master · Skm26/basic-programs · GitHub
Skm26
/
basic-programs
Public
forked from
utkarsh-shekhar/basic-programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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
basic-programs
/
java
/
Overload.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (39 loc) · 958 Bytes
Breadcrumbs
basic-programs
/
java
/
Overload.java
Copy path
File metadata and controls
49 lines (39 loc) · 958 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* This program demonstrate the method overloading
*/
class
OverloadDemo
{
void
test
()
{
System
.
out
.
println
(
"No parameters"
);
}
/* Overload the test for one integer parameter */
void
test
(
int
a
)
{
System
.
out
.
println
(
"a : "
+
a
);
}
/* Overload the test for two integer parameters */
void
test
(
int
a
,
int
b
)
{
System
.
out
.
println
(
"a is "
+
a
+
"
\n
b is "
+
b
);
}
/* Overload the test for a double parameter */
double
test
(
double
a
)
{
System
.
out
.
println
(
"double a : "
+
a
);
return
a
*
a
;
}
}
class
Overload
{
public
static
void
main
(
String
args
[])
{
OverloadDemo
ob
=
new
OverloadDemo
();
double
result
;
/* all the version of method test() */
ob
.
test
();
ob
.
test
(
100
);
ob
.
test
(
100
,
200
);
result
=
ob
.
test
(
123.25
);
System
.
out
.
println
(
"Result of ob.test(123.25) is "
+
result
);
}
}
Back
|
FazBrowse Home
|
New Git URL