1、1. 写一种函数,例如:给你 a b c 则输出 abc acb bac bca cab cba
package test;
import java.util.ArrayList;
import java.util.List;
public class ListOpreation {
public static void main(String[] args){
String s = "ABCD";
List
2、m.out.println(list);
}
public static List
3、st(new StringBuilder(base).deleteCharAt(i).toString(),buff+base.charAt(i));
result.addAll(temp);
}
for(int i=0;i 4、buff+"#");
}
return result;
}
}
执行成果:
2. 写一种函数,给你一种字符串 倒序输出来。
package test;
public class ListOperation {
public static void main(String[] args){
String str = "aadsfdfgdfcvsdfsdf";
strOperation(str);
}
private static void strOperation(String str) {
// TODO Auto 5、generated method stub
System.out.println("str:"+str);
String newStr = "";
for(int i=0;i 6、 ListOperation1 {
public static void main(String[] args){
int a = 20;
int b = 30;
a = a*b;
b = a/b;
a = a/b;
System.out.println("a= "+a+'\n'+"b= "+b);
}
}
4. 冒泡排序
package test;
public class ListOperation2 {
public static void main(String[] args){
int[] list = {20 7、27,15,29,4,14,28};
sort(list);
for(int i=0;i 8、 temp = list[j];
list[j] = list[i];
list[i] = temp;
}
}
}
return list;
}
}
执行成果:
5. 将一种文献复制到另一种文献中。
package test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.I 9、OException;
public class ListOperation3 {
public static void main(String[] args){
File oldFile = new File("D:\\1.txt");
File newFile = new File("D:\\2.txt");
try {
FileInputStream fis = new FileInputStream(oldFile);
FileOutputStream fos = new FileOutputStream(newFile);
int 10、read = 0;
while((read=fis.read())!=-1){
fos.write(read);
fos.flush();
}
fos.close();
fis.close();
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
11、 e.printStackTrace();
}
}
}
执行成果:
6. 将this is a test 转化为This Is A Test
package test;
public class ListOperation4 {
public static void main(String[] args){
String str = new String("this is a good person");
char[] c = new char[str.length()];
str.getChars(0,str.length(),c,0 12、);
if(c[0]>='a'&&c[0]<='z'){
c[0] = (char)(c[0]-32);
}
for(int i=1;i 13、age test;
import java.util.Scanner;
public class ListOperation5 {
public static void main(String[] args){
int countNum = 0;
int countWord = 0;
int countBlank = 0;
int countOther = 0;
Scanner in = new Scanner(System.in);
System.out.println("请输入字符串:");
String str = in.next 14、Line();
char[] ch = str.toCharArray();
for(int i=0;i






