2012年10月28日

关于多态

摘要: 1 public class Polymorphism { 2 3 4 /** 5 * @param args 6 */ 7 public static void main(String[] args) { 8 9 Human personA = new man(); 10 // personA.sleep(); 11 // personA.eat(); 12 System.out.println("*********************************... 阅读全文

posted @ 2012-10-28 23:24 chlde2500 阅读(186) 评论(2) 推荐(0)

做过的笔试题

摘要: 1.有一数组S[] = {good,apple,fix,king,soft,god,food},要求将这个数组按照首字母分成多个数组,使其成为{apple},{fix,food},{good,god}这种,每一个数组内都是这样有序的。View Code 1 import java.util.ArrayList; 2 3 4 public class strings { 5 6 public ArrayList<ArrayList<String>> get(String[] s){ 7 ArrayList<ArrayList<String>> ar 阅读全文

posted @ 2012-10-28 20:06 chlde2500 阅读(174) 评论(0) 推荐(0)

四个线程,对一个变量进行+1,-1。用Thread和Runnable实现

摘要: 1 public class Mtest { 2 3 int j; 4 5 public synchronized void inc(){ 6 j++; 7 System.out.println("plus j is:"+j+"/t thread is:"+Thread.currentThread().getName()); 8 } 9 10 public synchronized void dec(){11 j--;12 System.out.println("menurs ... 阅读全文

posted @ 2012-10-28 16:36 chlde2500 阅读(557) 评论(0) 推荐(0)

导航