Skip to content

Commit e9b8813

Browse files
author
nandini
committed
swap
1 parent a060836 commit e9b8813

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.tecmax.methodExamples;
2+
3+
import java.awt.List;
4+
import java.util.ArrayList;
5+
6+
public class arraylisttoarray {
7+
8+
public static void main(String[] args) {
9+
// TODO Auto-generated method stub
10+
List<Integer> list=new ArrayList<>();
11+
list.add(1);
12+
list.add(2);
13+
list.add(3);
14+
Integer []intArray=new Integer[list.size()];
15+
list.toArray(intArray);
16+
for(Integer integer:intArray) {
17+
System.out.println(integer);
18+
}
19+
20+
}
21+
22+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.tecmax.methodExamples;
2+
3+
public class swapingsring {
4+
pub
5+
6+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.tecmax.methodExamples;
2+
3+
public class swapstr {
4+
5+
public static void main(String[] args) {
6+
// TODO Auto-generated method stub
7+
String a="java";
8+
String b="programming";
9+
10+
a.concat(b);
11+
b=a.substring(0, (a.length()-b.length()));
12+
a=a.substring(b.length());
13+
System.out.println("value of a: "+a);
14+
System.out.println("value of b: "+b);
15+
16+
17+
}
18+
19+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.tecmax.methodExamples;
2+
3+
public class swapstring {
4+
5+
}

0 commit comments

Comments
 (0)