摘要: @Test public void test(){ Collection<String> c = new HashSet<String>(); c.add("java"); c.add("php"); c.add("cpp"); c.add("c#"); for(String str:c){ Sys 阅读全文
posted @ 2017-06-01 20:32 两枝梅 阅读(859) 评论(0) 推荐(0) 编辑
摘要: @Test public void testRemove(){ Collection<String> c = new HashSet<String>(); c.add("java"); c.add("php"); c.add("cpp"); c.add("c#"); Iterator<String> 阅读全文
posted @ 2017-06-01 20:30 两枝梅 阅读(1920) 评论(0) 推荐(0) 编辑
摘要: @Test public void testIte(){ Collection<String> c = new HashSet<String>(); c.add("java"); c.add("php"); c.add("cpp"); c.add("c#"); Iterator<String> it 阅读全文
posted @ 2017-06-01 20:27 两枝梅 阅读(1311) 评论(0) 推荐(0) 编辑
摘要: import java.util.ArrayList;import java.util.Collection;import java.util.HashSet;import org.junit.Test;public class TestCollection { @Test public void 阅读全文
posted @ 2017-06-01 20:22 两枝梅 阅读(1501) 评论(0) 推荐(0) 编辑
摘要: @Test public void testFormat(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); Date date = new Date(); String dataStr = sdf.forma 阅读全文
posted @ 2017-06-01 20:15 两枝梅 阅读(687) 评论(0) 推荐(0) 编辑
摘要: 使用setTime和getTime方法操作毫秒表示的日期-时间,获取1970年1月1日零时据当前时刻的毫秒数。获取明天此时此刻的日期-时间 @Test public void testGetTime(){ Date date = new Date(); System.out.println(date 阅读全文
posted @ 2017-06-01 18:23 两枝梅 阅读(2495) 评论(0) 推荐(0) 编辑
摘要: 使用replaceAll实现字符串替换,具体要求为将字符串“abc123bcd45ef6g7890”中的数字替换成汉字“数字”,如果是连续的数字那么替换为一个汉字“数字”。 在Java api中的String类提供了replaceAll方法,实现将字符串中匹配正则表达式的字符串替换成其它字符串,re 阅读全文
posted @ 2017-06-01 16:58 两枝梅 阅读(6118) 评论(0) 推荐(0) 编辑
摘要: @Test public void testSplit(){ //按空格拆分 String str = "java ee php c#"; String[] strArr = str.split("\\s"); System.out.println(Arrays.toString(strArr)); 阅读全文
posted @ 2017-06-01 16:47 两枝梅 阅读(182) 评论(0) 推荐(0) 编辑
摘要: public void main(){ String emailRegEx = "^[a-zA-Z0-9_\\.-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9]{2,4}$"; String email = "bieg@qef.com"; System.out.println(e 阅读全文
posted @ 2017-06-01 16:39 两枝梅 阅读(1542) 评论(0) 推荐(0) 编辑
摘要: 选择项目添加jar包,导入包 import org.junit.Test; import org.junit.Test;public class TestString { @Test public void testConstantPool(){ String str1 = "Hello"; //不 阅读全文
posted @ 2017-06-01 15:03 两枝梅 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 字符串基本操作 阅读全文
posted @ 2017-06-01 14:52 两枝梅 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 主函数测试方法: public class TestATM { public static void main(String[] args) { ABCATM a = new ABCATM(); //ICBCImpl icbc = new ICBCImpl(3000, "123456");//工商卡 阅读全文
posted @ 2017-06-01 13:42 两枝梅 阅读(227) 评论(0) 推荐(0) 编辑
摘要: UnionPay接口:用于描述银联统一指定的规则 public interface UnionPay { /* * 接口:用于描述银联统一指定的规则 */ public double getBalance();//查看余额 public boolean drawMoney(double number 阅读全文
posted @ 2017-06-01 11:00 两枝梅 阅读(480) 评论(0) 推荐(0) 编辑
摘要: 抽象类:Shape public abstract class Shape { protected double c; public abstract double area();} 类Square正方形,继承抽象类 public class Square extends Shape{ public 阅读全文
posted @ 2017-06-01 09:56 两枝梅 阅读(504) 评论(0) 推荐(0) 编辑