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
int len=sheepList.size(); int count=0; Iterator<Sheep> itr=sheepList.iterator(); while(itr.hasNext()){ if(count>len-4){ itr.next(); itr.remove(); } else {itr.next(); count++; } }
package cn.edu.nuc.NewClass4; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class test { public static void main(String[] args) { // TODO Auto-generated method stub File file = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest"); File file1 = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest\\1\\2"); File file2 = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest\\helloworld.txt"); File file3 = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest\\1\\2\\helloworld1.txt"); File file4 = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest\\1\\2\\helloworld2.txt"); File file5 = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest\\1\\2\\helloworld3.txt"); File file6 = new File("E:\\Android\\Eclipse_workspace\\NewClass4\\iotest\\1\\2\\helloworld4.txt"); try { file.mkdir(); file1.mkdirs(); file2.createNewFile(); file3.createNewFile(); file4.createNewFile(); file5.createNewFile(); file6.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String[] name=file.list(); for(int i=0;i<name.length;i++){ System.out.println(name[i]); } OutputStream IO = null; File[] Name=null; Name=file1.listFiles(); System.out.println(Name.length); for(int i=0;i<Name.length;i++){ try { IO=new FileOutputStream(Name[i], true); String s="中北大学安卓实验室"; IO.write(s.getBytes()); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }try { IO.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
package cn.edu.nuc.NewClass5; public class test { public static void main(String[] args) { // TODO Auto-generated method stub ThreadExtend H1=new ThreadExtend("一号"); ThreadExtend H2=new ThreadExtend("二号"); ThreadExtend H3=new ThreadExtend("三号"); H1.start(); H2.start(); H3.start(); ThreadImpl h=new ThreadImpl("一号"); new Thread(h).start(); new Thread(h).start(); new Thread(h).start(); } } class ThreadImpl implements Runnable{ private int number =10; private String name; public ThreadImpl(String name) { this.name = name; } @Override public void run() { // TODO Auto-generated method stub System.out.println("我是实现Runnable"); for(int i=0;i<10;i++){ System.out.println("Runnable线程:"+this.name+",i="+number--); if(number<1) break; } } } class ThreadExtend extends Thread{ private int number =10; public ThreadExtend(String name){ super(name); } public ThreadExtend(){ super(); } public void run(){ for(int i=0;i<10;i++){ if(number<1) break; System.out.println("Thread线程:"+this.getName()+number--); } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
删除后三只羊
往文件中加
Java中Runnable和Thread的区别
The text was updated successfully, but these errors were encountered: