- 博客(17)
- 收藏
- 关注
原创 作业
import java.util.regex.Matcher; import java.util.regex.Pattern; public class TestPattern { public static void main(String[] args) { // Pattern p =Pattern.compile("a*b");//获取到了正则表达式 // Matcher
2017-10-12 09:58:26 109
原创 作业
public class TestGroup { public static void main(String[] args) { // 叠词 快快乐乐 高高兴兴 // \\1代表第一组又出现一次 \\2代表第二组又出现一次 // String regex ="(.)\\1(.)\\2"; // System.out.println("快快乐乐".matches(regex)); //
2017-10-12 09:37:59 143
原创 作业
public static void main(String[] args) { //需求:请按照叠词切割“sdqqfgkkkhjppppkl” String s = "Oncela2wolf,3alAway4a5wolf"; String regex= "\\d"; String s2 = s.replaceAll(regex,""); System.out.println(s2);
2017-10-12 09:37:27 128
原创 作业
/* * 字符串排序 *有字符串90 27 46 38 50 写代码实现最终输出结果是 27 38 46 50 91 * *分析 *将字符串切割成字符串数组 *将字符串 */ public class TestString { public static void main(String[] args) { String s = "90 27 46 38 50
2017-10-12 09:36:41 127
原创 笔记
凡是与输入,输出相关的类,接口等等都定义在java.io包下 * File是一个类,可以有构造器创建的对象此对象对应着一个文件或文件目录 * File类对象是与平台无关的 * File中的 方法,仅涉及到如何创建,删除,重命名只要涉及到文件的内容 * File类的对象作为IO流的具体类的构造的构造器的形参 @Test public void
2017-09-21 18:41:07 133
原创 笔记
Map map; //增 保存 public void save(String id,T entity){ map.put(id, entity); } //查 获取 根据id查找对象 public T get(String id){ return map.get(id); } //改 更新替换map中key为id的内容,改为entit
2017-09-21 18:40:26 138
原创 笔记
java.io.File类 * 凡是与输入,输出相关的类,接口等等都定义在java.io包下 * File是一个类,可以有构造器创建的对象此对象对应着一个文件或文件目录 * File类对象是与平台无关的 * File中的 方法,仅涉及到如何创建,删除,重命名只要涉及到文件的内容 * File类的对象作为IO流的具体类的构造的构造器的形参 *
2017-09-21 18:39:51 295
原创 笔记
小范例 public static void main(String[] args){ Test test=new Test test.map=new HashMap test.save("1001", new FanXing(1,55,"红激光")); test.save("1002", new FanXing(2,44,"红激光")); test.save(
2017-09-21 18:38:50 141
原创 笔记
Tist方法 public class TestList { //ArrayList:List主要实现类 @Test public void test2(){ List list = new ArrayList(); list.add(123); list.add(456); list.add(new
2017-09-18 16:18:06 268
原创 笔记
集合的总接口Collection 一些Collection集合的方法 1)size()返回集合中元素(对象)的个数 2)add(Object obj);向集合中添加一个元素 3)addAll(Collection coll):将形参coll中包含的所有元素添加到当 前集合中 4)isEmpty(): 判断是否为空 5)clear():清空集合元素 6)contains(
2017-09-18 16:17:13 301
原创 笔记
集合: TreeSet前面用什么类型后面就用什么类型 只能添加一种 TreeSet按照首字母排序 @Test public void test(){ List list=new ArrayList(); list.add(123); list.add(456); list.add(new String("AA")); list.add(new String("BB")); Sys
2017-09-18 16:12:05 306
原创 biji
集合的三大特性: (1)确定性: 对于任意一个元素,要么它属于某个指定集合,要么它不属于该集合,二者必居其一。 (2) 互异性: 同一个集合中的元素是互不相同的。 (3) 无序性:任意改变集合中元素的排列次序,它们仍然表示同一个集合。 代码块: Collection coll=new ArrayList(); //1.size():返回 集合元素(对象)
2017-09-18 16:11:35 369
原创 笔记
@Test public void test2() { Collection coll = new ArrayList(); coll.add(123); coll.add("AA"); coll.add(new Date()); // coll.add("BB"); // Person p = new Person("MM",22); // coll.add(p); coll.
2017-09-13 16:33:19 102
原创 史忠政
1、Collection 和 Collections的区别 2、Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别 Set里的元素是不能重复的,那么用iterator()方法来区分重复与否。equals()是判读两个Set是否相等。 equals()和==方法决定引用值是否指向同一对象equals()在类中被覆盖,为的是当
2017-09-13 11:24:15 195
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人