We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
线程********************************************** class A implements Runnable { private String name ; private int Apple; public A(String name){ this.name = name; } public void run(){ for (Apple = 6;Apple >= 0 ;Apple-- ) { System.out.println(name + "卖苹果:"+Apple); } } } public class ceshi extends Thread { private String name; private int ticket; public ceshi(String name){ this.name = name; } public void run(){ for (ticket = 5 ;ticket>= 0 ;ticket-- ) { System.out.println(name+"卖票: "+ticket); } } public static void main(String[] args){ ceshi c1 = new ceshi("A"); //资源不共享 ceshi c2 = new ceshi("B"); ceshi c3 = new ceshi("C"); c1.start(); c2.start(); c3.start(); System.out.println("*************************"); A C = new A("老王"); //资源达到共享 new Thread(C).start(); new Thread(C).start(); new Thread(C).start(); } } *********************************************************、 删羊: List<String> AllList = null; AllList = new ArrayList<String>(); AllList.add("Hello1"); AllList.add("Hello2"); AllList.add("Hello3"); AllList.add("Hello4"); AllList.add("Hello5"); System.out.println(AllList); //System.out.println(AllList.get(0)); List<String>SubList = AllList.subList(2,4);//通过截取部分集合删除羊1 for (int i = 0;i <SubList.size();i++){ System.out.println(SubList.get(i)+" "); } for (int i = 0;i <AllList.size()-2;i++){ //删除羊2 System.out.print(AllList.get(i+2)+" "); } System.out.println(); for (int i = 0 ; i < 3; i++){ //删除羊3 AllList.remove(i); } System.out.println(AllList); *********************************************************************** 写文件: import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; public class IOdemo { public static void main(String[] args)throws Exception{ File f = new File("e:"+File.separator+"text.txt"); OutputStream out = new FileOutputStream(f); String st = "Hello world"; byte b[] = st.getBytes(); for (int i = 0;i<b.length ;i++ ) { out.write(b[i]); } out.close(); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: