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
//Delete_Sheep================================================ ArrayList<sheep> sheeplist=new ArrayList<sheep>(); sheeplist.add(new sheep("1")); sheeplist.add(new sheep("2")); sheeplist.add(new sheep("3")); sheeplist.add(new sheep("4")); sheeplist.add(new sheep("5")); sheeplist.add(new sheep("6")); int i=0; // /*方法一*/:for(i=5;i>2;i--) // sheeplist.remove(sheeplist.get(i)); // // // /*方法二*/:for(i=0;i<3;i++) // sheeplist.remove(sheeplist.get(3)); // // /*方法三*/:while(sheeplist.size()!=3) // sheeplist.remove(sheeplist.get(3)); for(i=0;i<3;i++) System.out.println(((sheep)(sheeplist.get(i))).getName()); //====================================================================== //Create_FileAuto========================================================= public class fileTEST { public static void main(String[] args) { //建立hello world文件 File manyfile=new File("D:\\test"); manyfile.mkdir(); File file = null; try { manyfile.mkdir(); for(int i=0;i<10;i++) { file=new File(manyfile,"helloworld"+i+".txt"); file.createNewFile(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { for(int i=0;i<10;i++) { OutputStream os=new FileOutputStream("D:\\test\\helloworld"+i+".txt"); String s="andriod lab"+i; os.write(s.getBytes()); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { InputStream is=new FileInputStream("D:\\test\\helloworld"+0+".txt"); byte[] read=new byte[1024]; is.read(read); System.out.println(); } catch (Exception e) { // TODO: handle exception } } } //============================================================ //Threads===================================================== public class cyh { public static void main(String[] args) { threadx thread1=new threadx(); threadx thread2=new threadx(); thread1.start(); thread2.start(); thready thread3=new thready(); thready thread4=new thready(); Thread thread5=new Thread(thread3); Thread thread6=new Thread(thread4); thread5.start(); thread6.start(); } } class threadx extends Thread{ public void run(){ System.out.println("openThread"); } static int a=0; } class s{ } class thready extends s implements Runnable{ public void run() { System.out.println("openRunnable"); } }
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: