![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
j2se
iteye_4104
这个作者很懒,什么都没留下…
展开
-
继承Thread类
[code="java"] public class Example2_4 extends Thread{ public static void main(String[] args) { //初始化线程 Example2_4 e = new Example2_4(); //启动线程 e.start(); System.out.println("----")...2010-04-13 23:01:08 · 77 阅读 · 0 评论 -
画多边形
[code="java"]public class HourGlass extends Applet { public void paint(Graphics g){ int[] xPoints = {30,200,30,200,30}; int[] yPoints = {30,30,200,200,30}; int num =5; g.drawPolygon(xP...2010-04-14 17:22:32 · 137 阅读 · 0 评论 -
实现Runnable接口
[code="java"] public class Test2 { public static void main(String[] args) { MyRunnable mr = new MyRunnable(); Thread t = new Thread(mr); //启动 t.start(); try { for (int i = 0; i...2010-04-14 22:56:34 · 63 阅读 · 0 评论 -
this关键字的使用
[code="java"] /** * 使用this 引用成员变量 * @author zhouyu260 * */ public class ReferenceVariable { private int a;//成员变量 public ReferenceVariable(int a) {//传入参数a this.a ...2010-04-16 22:34:51 · 61 阅读 · 0 评论 -
使用this引用构造方法
[code="java"]/** * 引用构造方法 * @author zhouyu260 * */ public class ReferenceConstructor { int a; public ReferenceConstructor() { //这里不能出现任何可执行代码,例如System.out.print(a); this(5); }...2010-04-16 22:58:43 · 72 阅读 · 0 评论 -
使用this代表自身类的对象
[code="java"] /** * 代表自身类的对象 * @author Administrator * */ public class ReferenceObject { ReferenceObject instance; public ReferenceObject() { instance = this;//将this的值赋给instance ...2010-04-16 23:08:33 · 264 阅读 · 0 评论 -
使用this引用成员方法
[code="java"] /** * 引用成员方法 * @author zhouyu260 * */ public class ReferenceMethod { public void r1(int a){ System.out.println(a); } public void r2(int a){ this.r1(a); } ...2010-04-16 23:19:36 · 185 阅读 · 0 评论 -
使用this引用成员方法
[code="java"] /** * 引用成员方法 * @author zhouyu260 * */ public class ReferenceMethod { public void r1(int a){ System.out.println(a); } public void r2(int a){ this.r1(a); } ...2010-04-16 23:19:42 · 101 阅读 · 0 评论 -
this和super的区别
this关键字代表自身,super关键字可以在子类中引用父类的内容。 [list] [b]this[/b] [*]使用this关键字引用成员变量。 [*]使用this关键字在自身构造方法内部引用其他构造方法。 [*]使用this关键字代表自身类的对象。 [*]使用this关键字引用成员方法 [/list] [list] [b]super[/b] [*]在子类的构造方法内部引用父...2010-04-17 00:03:50 · 57 阅读 · 0 评论