摘要: String1.String s="abc"=>"abc"是一个String对象,创建之后将不能修改2.各种方法: 获取1 * 1.获取长度:public int length();2 * 2.获取某位置字符:public char charAt(int index);3 * 3.根据字符asci... 阅读全文
posted @ 2015-08-11 10:00 洱海 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 第一种创建方式:继承Thread类复写Tread的run()方法,调用start()开启线程并执行 1 /** 2 *Xiancheng2继承Thread类,实现run()方法 3 *main即为主线程 4 *线程随机访问 5 */ 6 class XianCheng2 extends Thread... 阅读全文
posted @ 2015-08-04 15:29 洱海 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 需求:1.在E:\Test中编写两个java类TestPackage1.java和TestPackage2.java,分别属于包pack1和pack2,且TestPackage1.java调用TestPackage2.java的show()方法2.将两个包存放在E:\Test文件夹下3.将两个包压缩... 阅读全文
posted @ 2015-08-04 11:50 洱海 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Howpackage 包名; 且放在类中代码的第一行package myclass;编译:javac -d 包父目录(如D:\Learning\myclass 则写到D:\Learnig) 类名.java javac -d . Demo.java执行:1.set classpath=包地址 2... 阅读全文
posted @ 2015-08-03 08:48 洱海 阅读(122) 评论(0) 推荐(0) 编辑
摘要: How 1 XXMethod()throws Child1Exception,Child2ExCeption//除了RuntimeExceptiong及其子类,均要throws异常 2 { 3 try 4 { 5 //抛出Chi... 阅读全文
posted @ 2015-08-02 21:27 洱海 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Hownew 父类或接口(){继承父类或者实现接口所需的内容}; //注意理解这里的分号补全以下内容 1 interface Inter 2 { 3 void method(); 4 } 5 class Test 6 { 7 //补全代码,要求通过内部类 8 9 10 }1... 阅读全文
posted @ 2015-08-02 21:04 洱海 阅读(140) 评论(0) 推荐(0) 编辑
摘要: HOW:基本使用 1 /** 2 *需求1:在Outer类中定义内部类Inner 3 *需求2:Inner内定义一个vistOuter方法访问Outer的x属性 4 *需求3:Outer内定义一个vist方法访问Inner的vistOuter方法 5 */ 6 class Outer 7 { 8 ... 阅读全文
posted @ 2015-08-01 13:50 洱海 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Object类是其他所有类的爹需求:复写Object类的public boolean equals(Objectobj)方法 1 /** 2 *需求:复写Object的public boolean equals(Object obj)方法 3 *功能:比较Person的num值与另一个对象的num值... 阅读全文
posted @ 2015-07-31 17:11 洱海 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 多态 函数体现如方法的重载多态 对象体现how1 class 猫 extends 动物{public void 吃(){}}2 动物 D=new 猫();3 D.吃();扩展:据此增强扩展性 1 abstract class Animal 2 { 3 abstract void eat... 阅读全文
posted @ 2015-07-30 15:14 洱海 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 继承 class A extends B{...} 在A的默认构造方法中第一行会默认调用父类B的构造方法super(); this代表本类引用,this.属性,this.方法(),还可以this()放在构造第一行表示调用构造 super与this用法一致,但代表父类的引用,即调用父类的属性方... 阅读全文
posted @ 2015-07-29 18:09 洱海 阅读(143) 评论(0) 推荐(0) 编辑
.First { margin: 10px 0; font-family: 'Microsoft Yahei'; text-align: left; padding: 6px 20px; color: #fff; background: #55895B; font-size: 20px; border-radius: 4px; clear: both; } .Second { margin: 10px 0; font-family: 'Microsoft Yahei'; padding: 6px 20px; background: #93C8A2; color: white; font-size: 18px; border-radius: 4px; clear: both; } .Third { margin: 10px 0; padding: 6px 20px; font-family: 'Microsoft Yahei'; margin: 15px 0; font-size: 16px; color: black; background: #C6EFD2; border-radius: 4px; clear: both; } .note { margin: 10px 0; padding: 15px 20px 15px 60px; background: #FCFAA9 url('http://images.cnblogs.com/cnblogs_com/libaoheng/305804/o_yellow-pin.png') no-repeat 20px 0; font-size: 15px; font-family: 'Microsoft Yahei'; box-shadow: 0 0 8px #aaa; clear: both; } .demo { text-align: left; padding: 6px 20px; overflow: auto; border-radius: 4px; background: orange; color: #fff; font-size: 16px; clear: both; } .cnblogs_Highlighter { border: solid 1px #ccc; clear: both; } .cnblogs_code { background: #EFFFF4; border: solid 0px #939393; font-size: 14px; clear: both; padding: 10px 20px; } .cnblogs_code pre { font-size: 14px; } .cnblogs_code span { font-family: Courier New; font-size: 14px; }