07 2011 档案

摘要:Card.java 1 /** 斗地主业务中的 扑克牌 类型 */ 2 public class Card { 3 public static final int THREE = 0; 4 public static final int FOUR = 1; 5 public static final int FIVE = 2; 6 public static final int SIX = 3; 7 public static final int SEVEN = 4; 8 public static final int EIGHT = 5; 9 public static final int 阅读全文
posted @ 2011-07-29 09:16 牧涛 阅读(1868) 评论(0) 推荐(0) 编辑
摘要:---Option.java---Question.java----SingleChoice.java ----MultiChoice.java---sQuestionDemo.java以下是具体内容: Option.java: 1 public class Option { 2 //名词都写成类 3 private char id; //A B C 4 private String text;//答案选项内容 5 6 public Option(){} 7 8 public Option (char id,String text){ 9 this.id=id;10 this.text=tex 阅读全文
posted @ 2011-07-27 10:32 牧涛 阅读(713) 评论(0) 推荐(0) 编辑
摘要:1 import java.text.ParseException; 2 import java.text.SimpleDateFormat; 3 import java.util.Calendar; 4 import java.util.Date; 5 import java.util.GregorianCalendar; 6 import java.util.Scanner; 7 8 public class CalDemo { 9 10 /**11 * @param args12 * @throws ParseException 13 */14 public static void m. 阅读全文
posted @ 2011-07-27 10:15 牧涛 阅读(883) 评论(0) 推荐(0) 编辑
摘要:1 public class StringBuilderDemo { 2 3 /** 4 * @param args 5 */ 6 public static void main(String[] args) { 7 // 8 // StringBuilder buf=new StringBuilder(); 9 // buf.append("李敖").append(":").10 // append("是著名的国学大师,前妻是胡女士").11 // insert(0, "大师").replace(1, 2, &q 阅读全文
posted @ 2011-07-27 10:03 牧涛 阅读(4730) 评论(0) 推荐(0) 编辑
摘要:1 import java.util.Scanner; 2 3 public class RegDemo { 4 5 /** 6 * @param args 7 * 1 对于坐标输入数据的匹配和解析 坐标的形式为"5,f"或"5 f"完成RegDemo的read方法 输入:2,3 8 * 输出:i:2,j:3 输入:2 3 输出:i:2,j:3 正则表达式为:^\d+(,\s?|\s+)?\d+$ 9 */10 public static void main(String[] args) {11 // TODO Auto-generated method 阅读全文
posted @ 2011-07-27 09:58 牧涛 阅读(310) 评论(0) 推荐(0) 编辑
摘要:1 public class InsertSort { 2 3 /** 4 * @param args 5 */ 6 public static void main(String[] args) { 7 // TODO Auto-generated method stub 8 int []ary =new int[]{2,5,1,4,8,3,6,9}; 9 //int []ary={2,5,1,4,8,3,6,9};10 ary=insertSort(ary);11 for(int i=0;i<ary.length;i++)12 {13 System.out.print(ary[i]+& 阅读全文
posted @ 2011-07-26 20:48 牧涛 阅读(173) 评论(0) 推荐(0) 编辑
摘要:1 import java.text.SimpleDateFormat; 2 import java.util.Calendar; 3 import java.util.Date; 4 import java.util.GregorianCalendar; 5 import java.util.Scanner; 6 7 public class ContractDate { 8 9 /**10 * @param args11 * 2 根据员工入职时间和合同期计算下一次合同签订时间12 * a 入职时间为指定格式字符串 13 * b 合同期单位为月 14 * c下次合同签订时间为到期前一个月份. 阅读全文
posted @ 2011-07-26 20:45 牧涛 阅读(727) 评论(0) 推荐(0) 编辑
摘要:1 public static void main(String[] args) { 2 System.out.print(ascii("abc中国你好!")); 3 } 4 /** 5 //案例:控制台输入一串字符串 6 //转义输出为 "\ uxxxx" 的形式,英文不处理 7 //如:"A中" -> "A\u4e2d" 8 * 9 */10 public static String ascii(String s){11 StringBuilder buf=new StringBuilder();12 c 阅读全文
posted @ 2011-07-26 15:50 牧涛 阅读(3330) 评论(0) 推荐(0) 编辑
摘要:1 public class SelectSortDemo { 3 /** 4 * @param args 5 * 选择排序 抗压性 6 */ 7 public static void main(String[] args) { 8 // TODO Auto-generated method stub 9 int[] ary = { 8, 3, 5, 1, 4, 2, 7 };10 ary = selectSort(ary);11 for (int i = 0; i < ary.length; i++) {12 System.out.print(ary[i] + " " 阅读全文
posted @ 2011-07-26 11:20 牧涛 阅读(212) 评论(0) 推荐(0) 编辑
摘要:1 public class Valigin { 2 3 /** 4 * @param args 5 * 实现文字竖排,看谁不回帖 6 * 修改。。 7 */ 8 public static void main(String[] args) { 9 String str="锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。";10 String txt = valign(str, 5);11 System.out.println(txt);12 }13 public static String valign(String txt, int charPerCol) {14 in 阅读全文
posted @ 2011-07-26 11:18 牧涛 阅读(371) 评论(0) 推荐(0) 编辑
摘要:1 public class BubbleSortDemo { 2 3 /** 4 * @param args 5 */ 6 public static void main(String[] args) { 7 // TODO Auto-generated method stub 8 int []ary=new int[]{2,1,4,3,7,5,6,9}; 9 ary=bubblesort(ary);10 for (int i = 0; i < ary.length; i++) {11 System.out.print(ary[i] + " ");12 }13 }1 阅读全文
posted @ 2011-07-26 09:18 牧涛 阅读(207) 评论(0) 推荐(0) 编辑
摘要:一个实体类的定义: 1 有包 2 有无参数构造器 3 属性一般私有 4 适当的有参数构造器重载 5 属性有getter,setter访问方法 6 覆盖(重写)toString ,equals,hashCode 阅读全文
posted @ 2011-07-26 09:01 牧涛 阅读(601) 评论(0) 推荐(0) 编辑
摘要:String 字符串 一串字符就是字符串:char[],String,StringBuilder 1 字符产“字面量”都是String类型实例 String 内部就是一个char[]. 2 String API 有一个实现原则:对象内容永远被容不变 也就是说:String对象永远不变 3 String 字面量(直接量),如果相同,会替换为同一个String对象的引用, 常量连接的结果也被优化为同一个字符串。 4 String 的比较equals , hasCode() 5 String API(字符串的常用方法) 这些方法如果返回String 一定是一个新String对象 toString() 阅读全文
posted @ 2011-07-26 08:33 牧涛 阅读(2662) 评论(0) 推荐(0) 编辑