-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayLiteralsConcept.java
More file actions
55 lines (43 loc) · 1.2 KB
/
Copy pathArrayLiteralsConcept.java
File metadata and controls
55 lines (43 loc) · 1.2 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
45
46
47
48
49
50
51
52
53
54
55
package com.CoreJava;
import java.util.Arrays;
public class ArrayLiteralsConcept {
public static void main(String[] args) {
// TODO Auto-generated method stub
// 2. Array Literals
int a[] = { 1, 3, 4, 55, 23, 12, 101 };// 7
// int ar[] = new int[4];//4
System.out.println(a.length);
System.out.println(Arrays.toString(a));
double d[] = { 1.1, 2.3, 4.5, 5.6 };
char vowles[] = { 'a', 'e', 'i', 'o', 'u' };
String browsers[] = { "chrome", "firefox", "IE", "Edge", "Safari" };
for (int k = 0; k < browsers.length; k++) {
System.out.println(browsers[k]);
// if(browsers[k].equals("IE")) {
// System.out.println("this is deprecated");
// }
switch (browsers[k]) {
case "chrome":
System.out.println("google");
break;
case "firefox":
System.out.println("mozilla");
break;
default:
break;
}
}
//
int ar[] = new int[4];
ar[0] = 100;
// ar[4] = 200;//ArrayIndexOutOfBoundsException
System.out.println(ar[4]);
// amazon -- sept 2023 -- [1000] -- 1 hr
// oct -- 25, left=25
// nov ---1000
// dec -- 5000
// 25th -- 100000
// uber
// 5 PM [100] --> [1000]
}
}