找传奇、传世资源到传世资源站!

java 入门级示例源码(类 继承 入门示例)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

from clipboard/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package javaapp913;import java.util.ArrayList;/** * * @author wangwei */public class Son extends Father{ private String Name; private Father father; private String Country; public Son() { int r1 = (int) (Math.random() * 10000) 25000; int r2 = (int) (Math.random() * 10000) 25000; this.Name = "张" (char)r1 (char)r2; } public Son(Father father) { this.father = father; int r1 = (int) (Math.random() * 10000) 25000; int r2 = (int) (Math.random() * 10000) 25000; this.Name = father.getFirstName() (char)r1 (char)r2; this.Country=father.getCountry(); father.addSon(this); } public void setFName(String fn){ String old = Name.substring(1); Name = fn old; } @Override public String getName(){ return this.Name; } @Override public String getCountry() { return this.Country; }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复