Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 35bd395

Browse files
boxing e unboxing de Intergers
1 parent 6a7189a commit 35bd395

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

‎src/module6/wrappers/Autoboxing.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ public class Autoboxing {
77

88
public static void main(String[] args) {
99

10-
int[] idades = new int[5];
11-
String[] nomes = new String[5];
12-
1310
int idade = 26; //Integer
14-
Integer idadeReferencia = new Integer(26);
11+
Integer idadeReferencia = Integer.valueOf(26);
12+
13+
//Autoboxing
1514
List<Integer> numeros = new ArrayList<Integer>();
16-
numeros.add(29);//Autoboxing
15+
numeros.add(29);
1716
}
1817
}

‎src/module6/wrappers/Unboxing.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package module6.wrappers;
2+
3+
public class Unboxing {
4+
5+
public static void main(String[] args) {
6+
7+
Integer idadeReferencia = Integer.valueOf(26);
8+
9+
//Unboxing
10+
int valor = idadeReferencia.intValue();
11+
12+
}
13+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /