接口中的几种方法如何继承
常用的权限修饰符排序
子类重写父类方法时如何处理异常
public class Fu {
public void show01() throws NullPointerException
, ClassCastException
{
}
;
public void show02() throws IndexOutOfBoundsException
{
}
;
public void show03() throws IndexOutOfBoundsException
{
}
;
public void show04() {
}
;
}
class zi extends Fu {
public void show01() throws NullPointerException
, ClassCastException
{
}
;
public void show02() throws ArrayIndexOutOfBoundsException
{
}
;
public void show03() {
}
;
public void show04() {
try {
throw new Exception("编译期异常");
} catch (Exception e
) {
e
.printStackTrace();
}
}
}
并行和并发
二线程的匿名内部类实现方法
package demo01
;
import java
.util
.Currency
;
public class Demo01 {
public static void main(String
[] args
) {
new Thread(){
@Override
public void run() {
for (int i
= 0; i
< 20; i
++) {
System
.out
.println(Thread
.currentThread().getName()+"-->"+i
);
}
}
}.start();
new Thread(new Runnable(){
@Override
public void run() {
for (int i
= 0; i
<20 ; i
++) {
System
.out
.println(Thread
.currentThread().getName()+"-->"+i
);
}
}
}).start();
}
}