-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df2118b
commit a60ef78
Showing
5 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package samples.javacore.cast.arrays; | ||
|
||
import static java.lang.String.valueOf; | ||
|
||
public class ArrayCastExample { | ||
public static void main(String[] args) { | ||
int[] ints = new int[] {1, 2, 3}; | ||
String[] strings = new String[] {"Hello", "World", "!"}; | ||
Object stringsObject = strings; | ||
System.out.println(valueOf(stringsObject).substring(0, 19)); | ||
Object intsObject = ints; | ||
System.out.println(valueOf(intsObject).substring(0, 2)); | ||
|
||
Object[] objects = (Object[]) stringsObject; | ||
for (Object o : objects) { | ||
System.out.print(o); | ||
} | ||
System.out.println(); | ||
} | ||
} |
Binary file added
BIN
+932 Bytes
tests/test_data/samples/javacore/cast/arrays/ArrayCastExample.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters