Skip to content

Commit 9493858

Browse files
author
nandini
committed
arrays to arraylist
1 parent cb57ae1 commit 9493858

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
package com.tecmax.methodExamples;
22

3+
import java.util.ArrayList;
4+
35
public class arrays {
6+
public class array {
7+
8+
public static void main(String[] args) {
9+
// TODO Auto-generated method stub
10+
ArrayList<String> a=new ArrayList<String>();
11+
a.add("nan");
12+
a.add("madhuri");
13+
a.add("swetha");
14+
a.add("dileep");
15+
System.out.println(a);
16+
a.remove("swetha");
17+
System.out.println(a);
18+
int pos=a.indexOf("Theja");
19+
String str=a.get(12);
20+
int numberofitems=a.size();
21+
System.out.println("current array List posiion Stringvalue size is:"+"\n"+a+"\n"+numberofitems);
22+
23+
}
24+
25+
}
26+
27+
public static String[] asList;
428

529
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.tecmax.methodExamples;
2+
3+
import java.awt.List;
4+
import java.util.Arrays;
5+
6+
public class arraytoarraylist {
7+
8+
public static void main(String[] args) {
9+
10+
// TODO Auto-generated method stub
11+
String[] a = { "dillu", "dillo", "sweha" };
12+
List<String> aa=Arrays.asList(a);
13+
System.out.println(aa);
14+
15+
}
16+
17+
}

0 commit comments

Comments
 (0)