package com.wh.Demo50;

/**
* @author 王恒
* @datetime 2017年4月7日 下午4:40:54
* @description
* 分析:子类重写父类的方法时,调用子类的构造方法
* 这是一道逻辑题,比较绕,不知道程序怎么走的时候,用debug模式,追踪走一边,所有方法均打断点
*/
public class Demo04_wolf {
public static void main(String[] args) {
Wolf w = new Wolf("灰太狼", 32.3);
System.out.println(w);
}
} class Animal { private String desc; public Animal() {
this.desc = getDesc();
} public String getDesc() {
return "Animal";
} public String toString() {
return desc;
}
} class Wolf extends Animal {
private String name;
private double weight; public Wolf(String name, double weight) {
// super();
this.name = name;
this.weight = weight;
} public String getDesc() {
return "Wolf[name=" + name + ", weight=" + weight + "]";
} }

  运行结果:

      Wolf[name=null, weight=0.0]

wolf的更多相关文章

  1. HDU 5115 Dire Wolf 区间dp

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5115 Dire Wolf Time Limit: 5000/5000 MS (Java/Others ...

  2. hdu 3046 Pleasant sheep and big big wolf 最小割

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3046 In ZJNU, there is a well-known prairie. And it a ...

  3. hdu 1222 Wolf and Rabbit

    Problem Description There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbi ...

  4. 动态规划(区间DP):HDU 5115 Dire Wolf

    Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not ...

  5. 分布式批处理平台(wolf)简介

    "wolf"即狼,狼的适应性很强.可栖息范围包括苔原.草原.森林.荒漠.农田等多种生境:具有敏锐的观察力.专一的目标.默契的配合,它们总能依靠团体的力量达成目标. 分布式批处理平台 ...

  6. Wolf and Rabbit(gcd)

    Wolf and Rabbit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  7. hdu 5115 Dire Wolf(区间dp)

    Problem Description Dire wolves, also known as Dark wolves, are extraordinarily large and powerful w ...

  8. HDU 3046 Pleasant sheep and big big wolf(最小割)

    HDU 3046 Pleasant sheep and big big wolf 题目链接 题意:一个n * m平面上,1是羊.2是狼,问最少要多少围墙才干把狼所有围住,每有到达羊的路径 思路:有羊和 ...

  9. HDU 1222 Wolf and Rabbit(gcd)

    HDU 1222   Wolf and Rabbit   (最大公约数)解题报告 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid= ...

  10. 转化为用欧几里得算法判断互质的问题D - Wolf and Rabbit

    Description There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must h ...

随机推荐

  1. AI:忧郁的机器人

    1.塔奇克马 塔奇克马研究起来哲学,被缴械....... 2.机器人瓦力 孤独等待EVA的瓦力 3.马文 http://www.guokr.com/post/683881/

  2. html 图片翻转

    var Lb = false; var Ub = false; function rotate(obj) { if (obj == "L") { if (Lb == false) ...

  3. jq 获取表单所有数据

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  4. XML文件读取加上 Ajax请求

    #region XML文件处理 XmlDocument doc = new XmlDocument(); XmlReaderSettings settings = new XmlReaderSetti ...

  5. 修复Thinkphp框架5.0和5.1版本的远程代码执行安全漏洞

    由于框架对控制器名没有进行足够的检测会导致在没有开启强制路由的情况下可能的getshell漏洞.最直接的影响为index.php直接被篡改成首页html的内容! 5.0版本 thinkphp/libr ...

  6. Git server出现cache大回收分析

    实例 git server是一个io密集型的服务,当cache量很大的时候,cache会全部一次释放,导致那么一瞬间,IO read压力很大,因为,用户的大量请求,需要重新从磁盘读到内存,但是这个时刻 ...

  7. PL\SQL(day05)

    PLSQL 1.常用的访问数据库的相关技术 1) plsql 过程化的sql 2) proc/c++ 在c/c++语言中访问oracle数据库的技术 3) ado/odbc vc中访问数据库的技术 4 ...

  8. 32.es读请示内部分发原理

    当客户端发送一次读请求时,大致会经过以下几个步骤 1.客户端发送一个请求过去,es的一个node接收到这个请求(随机的node),这个node就被es内部分配成coordinating node(协调 ...

  9. Request中通过文件流获取文件

    第一次写博客,希望能帮到以后接触到这里的同学,废话不多说,面对疾风吧. /** * 获取文件相信信息 * @param request HttpServletRequest实例 * @param im ...

  10. redis命令学习的注意问题

    1.set get命令只用于字符串,get命令取key值时string正常返回,没有key返回nil,其他类型会报错 设置的时候是set test redis ex 200000等同于SETEX te ...