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. 点云处理软件Pointscene

    转载于PCL中国:点云处理软件Pointscene 软件官网:https://pointscene.com/ 笔者评:        Pointscene是目前的点云处理软件之一,其主要是操作简单直观 ...

  2. mvc重定向

    出处 : https://www.cnblogs.com/lgxlsm/p/5441149.html .重定向方法:Redirect / RedirectToAction / RedirectToRo ...

  3. LOJ #6041. 「雅礼集训 2017 Day7」事情的相似度 LCT+SAM+线段树

    Code: #include<bits/stdc++.h> #define maxn 200003 using namespace std; void setIO(string s) { ...

  4. [jzoj 5781]【NOIP提高A组模拟2018.8.8】秘密通道 (最短路)

    传送门 Description 有一副nm的地图,有nm块地,每块是下列四种中的一种: 墙:用#表示,墙有4个面,分别是前面,后面,左面,右面. 起点:用C表示,为主角的起点,是一片空地. 终点:用F ...

  5. SpringBoot背景

    1.SpringBoot的产生背景:随着spring日益发展,丰富的框架和组件大大简化了java项目开发过程,经过多年的实践,得到了很多人的认可,但是Spring的严重依赖XML配置文件,严重导致项目 ...

  6. poj 2763(LCA + dfs序 +树状数组)

    算是模板题了 可以用dfs序维护点到根的距离 注意些LCA的时候遇到MAXM,要-1 #include<cstdio> #include<algorithm> #include ...

  7. 【学习笔记】关于最大公约数(gcd)的定理

    手动博客搬家: 本文发表于20181004 00:21:28, 原地址https://blog.csdn.net/suncongbo/article/details/82935140 结论1 \[\g ...

  8. Spring MVC学习总结(4)——SpringMVC权限管理

    1.DispatcherServlet SpringMVC具有统一的入口DispatcherServlet,所有的请求都通过DispatcherServlet.     DispatcherServl ...

  9. HDU 2415 Bribing FIPA

    Bribing FIPA Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original I ...

  10. Set Time, Date Timezone in Linux from Command Line or Gnome | Use ntp

    https://www.garron.me/en/linux/set-time-date-timezone-ntp-linux-shell-gnome-command-line.html Set ti ...