阅读下列程序 写出运行结果 public class Fruit {
Fruit() {
System.out.println("Hello,This is a fruit!");
}
}
public class Apple extends Fruit {
Apple() {
System.out.println("Hello,The is an apple!");
}
public static void main(String[] args) {
Apple apple = new apple();
}
}
还有一题public class ExcSwqDcmo {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str="test";
boolean flag1=str.equals("malc");
boolean flag2=str.equals("fcmalc");
try{
System.out.println("T0");
if(!flag1||!flag2)
throw new GenderException();
System.out.println("T1");
}catch(GenderException e){
System.out.println("gender is wrong");
}catch(Exception){
System.out.println("T2");
}finally{
System.out.println("T3");
}
System.out.println("T4");
}
}