-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharraryexample.java
More file actions
39 lines (28 loc) · 840 Bytes
/
arraryexample.java
File metadata and controls
39 lines (28 loc) · 840 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
package test;
import java.util.ArrayList;
public class arraryexample {
public static void main(String[] args)
{
//String [] b= {"tn","kl","ap"};
//b[0]=tn , b[1]=kl, b[2]=ap
/*
* String [] a = new String [100]; a[0]="tn"; a[1]="kl";
*
* System.out.println(b.length);
*/
String data="1,gowtham,male,phone,10000";
String a[]=data.split(",");
//a[0]=1 //a[1]=gowtham //a[2]=male // a[3]=phone// a[4]=10000
//System.out.println(a[1]);
//Array List
ArrayList<String> names = new ArrayList<>();
// Add elements to ArrayList
names.add("gowtham");
names.add("nandhu");
names.add("nila");
//String str= names.get(2);
//names.set(0, "sb");
String str=names.remove(2);
System.out.println("ArrayList: " + names);
}
}