2013年3月11日

Java Clone(类的复制)

摘要: http://blog.csdn.net/ilibaba/article/details/3773545自己实现了一遍:public class A implements Cloneable { public String str[]; A() { str = new String[2]; } public Object clone() { A o = null; try { o = (A) super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); }... 阅读全文

posted @ 2013-03-11 11:43 Sure_Yi 阅读(230) 评论(0) 推荐(0) 编辑

2013年3月7日

Java类 clone方法

摘要: http://www.iteye.com/topic/182772 阅读全文

posted @ 2013-03-07 18:05 Sure_Yi 阅读(158) 评论(0) 推荐(0) 编辑

Java 对象 和 对象引用

摘要: http://www.java3z.com/cwbwebhome/article/article2/2370.html为便于说明,我们先定义一个简单的类:class Vehicle {int passengers;int fuelcap;int mpg;}有了这个模板,就可以用它来创建对象:Vehicle veh1 = new Vehicle();通常把这条语句的动作称之为创建一个对象,其实,它包含了四个动作:1)右边的“new Vehicle”,是以Vehicle类为模板,在堆空间里创建一个Vehicle类对象(也简称为Vehicle对象)。2)末尾的()意味着,在对象创建后,立即调用Veh 阅读全文

posted @ 2013-03-07 17:50 Sure_Yi 阅读(130) 评论(0) 推荐(0) 编辑

栈空间 和 堆空间

摘要: http://www.cnblogs.com/kevinGaoblog/archive/2012/03/23/2413102.htmlstack由系统自动分配,系统收回;heap需要程序员自己申请,C中用函数malloc分配空间,用free释放,C++用new分配,用delete释放。http://www.java3z.com/cwbwebhome/article/article2/2370.html在堆空间里创建的实体,与在数据段以及栈空间里创建的实体不同。尽管它们也是确确实实存在的实体,但是,我们看不见,也摸不着 阅读全文

posted @ 2013-03-07 17:41 Sure_Yi 阅读(144) 评论(0) 推荐(0) 编辑

2013年3月6日

成段更新(上色 POJ 2777)

摘要: import java.io.*;import java.util.*;import java.math.*;import java.text.*;public classMain { int L, T, O, A, B, C; Tree tree[]; int countBit(int x){ int out; for(out=0;x > 0;x>>=1) out+=x&1; return out; } void build(int pos, int lt, int rt) { tree[pos] = new Tree(); tree[pos].lt = lt; t 阅读全文

posted @ 2013-03-06 00:12 Sure_Yi 阅读(159) 评论(0) 推荐(0) 编辑

成段更新(加上一个值 POJ 3468)

摘要: http://blog.csdn.net/shiqi_614/article/details/8228102import java.io.*;import java.util.*;import java.math.*;import java.text.*;public classMain { int n, q, ar[], a, b, c; Tree tree[]; void build(int pos, int lt, int rt) { tree[pos] = new Tree(); tree[pos].lt = lt; tree[pos].rt = rt; tree[pos].ad... 阅读全文

posted @ 2013-03-06 00:08 Sure_Yi 阅读(165) 评论(0) 推荐(0) 编辑

2013年3月5日

成段更新(更新为一直特定的值 HDU 1698)

摘要: http://blog.csdn.net/shiqi_614/article/details/8228102import java.io.*;import java.util.*;import java.math.*;import java.text.*;public class Main { int t, n, q, a, b, c; Tree tree[]; void build(int pos, int lt, int rt) { tree[pos] = new Tree(); tree[pos].lt = lt; tr... 阅读全文

posted @ 2013-03-05 21:46 Sure_Yi 阅读(167) 评论(0) 推荐(0) 编辑

线段树 lazy 位运算 (POJ 2777)

摘要: import java.io.*;import java.util.*;import java.math.*;import java.text.*;public classMain { int L, T, O, A, B, C; Treetree[]; int countBit(int x){ int out; for(out=0;x > 0;x>>=1) out+=x&1; return out; } void build(int pos, int lt, int rt) { tree[pos] = new Tree(); tree[pos].lt = lt; tr 阅读全文

posted @ 2013-03-05 21:13 Sure_Yi 阅读(225) 评论(0) 推荐(0) 编辑

2013年3月4日

Java LinkedList ArrayList

摘要: http://blog.csdn.net/yanglei031/article/details/4538869一般大家都知道ArrayList和LinkedList的大致区别: 1.ArrayList是实现了基于动态数组的数据结构,LinkedList基于链表的数据结构。 2.对于随机访问get和set,ArrayList觉得优于LinkedList,因为LinkedList要移动指针。 3.对于新增和删除操作add和remove,LinedList比较占优势,因为ArrayList要移动数据。List是一个接口,而ListArray是一个类。ListArray继承并实现了List。所以Lis 阅读全文

posted @ 2013-03-04 19:06 Sure_Yi 阅读(255) 评论(0) 推荐(0) 编辑

String 使用方法

摘要: http://blog.csdn.net/fetch001/article/details/7561453string类适用于描述字符串事物。那么它就提供了多个方法对字符串进行操作以下是string的七种用法,注意哦,记得要时常去查看java的API文档,那个里面也有很详细的介绍1,获取1.1:字符串中包含的字符数,也就是字符串的长度。int length():获取长度1.2:根据位置获取位置上某个字符。char charAt(int index)1.3:根据字符获取该字符在字符串中的位置。int indexOf(int ch):返回的是ch在字符串中第一次出现的位置。int indexOf( 阅读全文

posted @ 2013-03-04 18:53 Sure_Yi 阅读(199) 评论(0) 推荐(0) 编辑

导航