forked from yogesh5259/Java-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.java
More file actions
44 lines (32 loc) · 1.02 KB
/
array.java
File metadata and controls
44 lines (32 loc) · 1.02 KB
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
public class array {
public static void main(String[] args) {
//Array
//fixed in size and homoginous
//Array declaration
//single dimension array
int[] a = new int[3];
int []b;
int c[];
//two dimension array declaration
int[] []d;
int[] e[];
int [][]f;
int []g[];
int[][] h;
int i[][];
//invalid
//int[] []j,[]k; this rule applicable for only first declaration.
// We can not specify array size in array declaration.
// Every array have related class. at language level which we dont have access.
System.out.println(a.getClass().getName()); //[I
int[] array = new int[3];
array[0] = 'a';
//array[1] = 10.10; //Possible lossy conversion from double to int
System.out.println(array[0]);
String s = "abc";
Object o = s;
int[][] z = new int[3][];
//z[0] = 10;
z[0] = new int[3];
}
}