-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSample2.java
More file actions
47 lines (43 loc) · 985 Bytes
/
Sample2.java
File metadata and controls
47 lines (43 loc) · 985 Bytes
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
import java.util.*;
public class Sample2 {
public static void main(String[] args)
{
ArrayList al=new ArrayList();
al.add(100);
al.add("time");
al.add(true);
al.add("Aman");
System.out.println(al);
System.out.println(al.get(0));
System.out.println(al.remove(3));
System.out.println(al);
al.add("Rock");
System.out.println(al);
al.add(0,"true");
System.out.println(al);
al.add(35);
al.add("surya");
al.add("satya");
al.add("auraj");
al.add("suraj");
for(int i=0;i<al.size();i++)
{
Object o= al.get(i);
// if(o instanceof Integer)
// {
// Integer n= (Integer)o;
// if(n%2 !=0)
// {
// System.out.println(n);
// }
// }
if(o instanceof String)
{
if(o.toString().startsWith("su"))
{
System.out.println(o);
}
}
}
}
}