03 2013 档案
摘要:四个抽象类:InputStream OutputStream (字节) Reader Writer (字符)import java.io.*;public class Test{public static void main(String args[]) throws Exception{FileOutputStream fos=new FileOutputStream("d:/007/a.txt");FileInputStream fis=new FileInputStream("d:/007/b.txt");int a=-1;while((a...
阅读全文
摘要:一、Map的keySet方法可拿到Map中所有的key,返回值是Set类型,set有iterator方法可以拿到迭代器,再利用map.get(key)这个方法迭代出里面的内容。例如:import java.util.*;public class Test{public static void main(String args[]){Map<String,Integer> map=new HashMap<String,Integer>();map.put("一",12);map.put("二",13);map.put("三
阅读全文
摘要:import java.util.*;public class Test{ public static void main(String args[]){ List<Person> list=new ArrayList<Person>(); list.add(new Person("jack",21)); list.add(new Person("rose",18)); list.add(new Person("tom",19)); list.add(new Person("spring",
阅读全文
摘要:import java.util.*;public class Test{ public static void main(String args[]){ List<Person> list=new ArrayList<Person>(); list.add(new Person("jack",21)); list.add(new Person("rose",18)); list.add(new Person("tom",19)); list.add(new Person("spring",
阅读全文
摘要:public class Demo6{ public static void main(String args[]){ for(int i=0;i<100;i++){ System.out.println("----main----"+i); } Thread t1=new Thread(new T1()); t1.start(); }}class T1 implements Runnable{ public void run(){ for(int i=0;i<100;i++){ if(i==5){ try{ Thread.sleep(3000); }ca...
阅读全文
摘要:public class Test{ public static void main(String args[]){ T1 t1=new T1(1); t1.start(); T1 t2=new T1(2); t2.start(); }}class T1 extends Thread{ public static Object o1=new Object(); public static Object o2=new Object(); int num; T1(int num){ this.num=num; } public void run(){ ...
阅读全文
摘要:public class Poi { public static void main(String[] args) { HSSFWorkbook workbook=new HSSFWorkbook(); HSSFSheet sheet=workbook.createSheet(); HSSFRow row=sheet.createRow(0); HSSFCell cell00=row.createCell(0); HSSFCell cell01=row.createCell(1); cell00.setCellValue("学生姓名"); cell01.setCellVal
阅读全文
浙公网安备 33010602011771号