package com.Object;class Animal { public int age=2; public String name; public void show(){ System.out.println("动物会吃草"); }} public class Dog extends Animal{ public static void main(String[] args) { Dog d = new Dog(); Dog d2 = new Dog(); if(d.equals(d2)){ System.out.println("两个对象是相同的"); }else{ System.out.println("两个对象是不同的"); } } }
添加回答
举报
0/150
提交
取消