#include <iostream>using namespace std;
class Per
{
private:friend const Per operator-(const Per &L,const Per &R);int a;int b;
public:Per(){cout<<"无参构造"<<endl;}Per(int a,int b):a(a),b(b){cout<<"有参构造&qu…
ClassCastException异常:
class Animal{}
class Dog extends Animal{}
class Cat extends Animal{}
public class Test5{public static void main(String[] args){Animal a new Dog();Cat c (Cat)a;}
}
执行结果如图所示: 解决 ClassCastException 的…