FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
OnJava8-Examples/functional/MultiUnbound.java at master · CSapprenticeWT/OnJava8-Examples · GitHub
CSapprenticeWT
OnJava8-Examples
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
OnJava8-Examples
/
functional
/
MultiUnbound.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (31 loc) · 959 Bytes
Breadcrumbs
OnJava8-Examples
/
functional
/
MultiUnbound.java
Copy path
File metadata and controls
36 lines (31 loc) · 959 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
// functional/MultiUnbound.java
// (c)2021 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Unbound methods with multiple arguments
class
This
{
void
two
(
int
i
,
double
d
) {}
void
three
(
int
i
,
double
d
,
String
s
) {}
void
four
(
int
i
,
double
d
,
String
s
,
char
c
) {}
}
interface
TwoArgs
{
void
call2
(
This
athis
,
int
i
,
double
d
);
}
interface
ThreeArgs
{
void
call3
(
This
athis
,
int
i
,
double
d
,
String
s
);
}
interface
FourArgs
{
void
call4
(
This
athis
,
int
i
,
double
d
,
String
s
,
char
c
);
}
public
class
MultiUnbound
{
public
static
void
main
(
String
[]
args
) {
TwoArgs
twoargs
=
This
::
two
;
ThreeArgs
threeargs
=
This
::
three
;
FourArgs
fourargs
=
This
::
four
;
This
athis
=
new
This
();
twoargs
.
call2
(
athis
,
11
,
3.14
);
threeargs
.
call3
(
athis
,
11
,
3.14
,
"Three"
);
fourargs
.
call4
(
athis
,
11
,
3.14
,
"Four"
,
'Z'
);
}
}
Back
|
FazBrowse Home
|
New Git URL