FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/boxing/BoxingUnBoxing.java at master · nitinteja/Java-Programs · GitHub
nitinteja
/
Java-Programs
Public
forked from
divScorp/Java-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
Java-Programs
/
boxing
/
BoxingUnBoxing.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (34 loc) · 1.13 KB
Breadcrumbs
Java-Programs
/
boxing
/
BoxingUnBoxing.java
Copy path
File metadata and controls
36 lines (34 loc) · 1.13 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
package
boxing
;
public
class
BoxingUnBoxing
{
public
static
void
main
(
String
args
[]) {
// Boxing
byte
a
=
1
;
Byte
byteobj
=
new
Byte
(
a
);
int
b
=
10
;
Integer
intobj
=
new
Integer
(
b
);
float
c
=
18.6f
;
Float
floatobj
=
new
Float
(
c
);
double
d
=
250.5
;
Double
doubleobj
=
new
Double
(
d
);
char
e
=
'a'
;
Character
charobj
=
e
;
System
.
out
.
println
(
"Values of Boxed objects (printing as objects)"
);
System
.
out
.
println
(
"Byte object byteobj: "
+
byteobj
);
System
.
out
.
println
(
"Integer object intobj: "
+
intobj
);
System
.
out
.
println
(
"Float object floatobj: "
+
floatobj
);
System
.
out
.
println
(
"Double object doubleobj: "
+
doubleobj
);
System
.
out
.
println
(
"Character object charobj: "
+
charobj
);
// UnBoxing
byte
bv
=
byteobj
;
int
iv
=
intobj
;
float
fv
=
floatobj
;
double
dv
=
doubleobj
;
char
cv
=
charobj
;
System
.
out
.
println
(
"
\n
UnBoxed values (printing as data types)"
);
System
.
out
.
println
(
"byte value, bv: "
+
bv
);
System
.
out
.
println
(
"int value, iv: "
+
iv
);
System
.
out
.
println
(
"float value, fv: "
+
fv
);
System
.
out
.
println
(
"double value, dv: "
+
dv
);
System
.
out
.
println
(
"char value, cv: "
+
cv
);
}
}
Back
|
FazBrowse Home
|
New Git URL