wolf

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]

时间: 2024-10-12 16:04:50

wolf的相关文章

HDU 5115 Dire Wolf 区间DP

Dire Wolf Problem Description Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor.Dire wolves look like normal wolves, but these creatures are of nearly

hdu 5115 Dire Wolf(区间dp)

Problem Description Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor. Dire wolves look like normal wolves, but these creatures are of nearly twice th

Hdu5115 Dire Wolf

Hdu5115 Dire Wolf http://acm.hdu.edu.cn/showproblem.php?pid=5115 题目大意:n头狼,分别有一个攻击力,而且分别有一个加持力,可以给左右两边的狼加相应的攻击力(边界的狼就只能给相邻的一头狼加) ,一个人要杀狼,杀一头狼时受到该狼的攻击力和来自周围的加持力.被杀死的狼的加持力消失,但其他狼又会更新加持力(因为相邻的位置变化了).问该人能够把全部狼杀光,且最小受到多少伤害? /* dp[i][j]表示从第i头狼到第j头狼全部被杀死的最小伤

UVAlive 10154:Dire Wolf 区间DP

Dire Wolf 题目链接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5073 题意: 有一排的狼,每只狼有一个基础攻击力a[i],和一个加成值b[i](可以给相邻的两只狼加b[i]点攻击力,这只狼死后就不加了),你每杀一只狼需要花费能量值(狼的当前攻击力),你杀了这只狼周围的狼会自动往中间聚集(即不会有空隙),求杀

转化为用欧几里得算法判断互质的问题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 hide in one of the holes. A wolf searches the rabbit in anticlockwise order. The first hole he get into is the one signed with 0. Then he will get into

Wolf and Rabbit

gcd(最大公因数)和lcm(最小公倍数) 辗转相除法求a和b的最大公因数和最小公倍数: 最小公倍数=a*b/最大公约数: 求最大公因数: int gcd(int a,int b) { int temp; if (a<b) { temp=a; a=b; b=temp; } while (b!=0) { temp=a%b; a=b; b=temp; } return a; } 求最小公倍数: int lcm(int x,int y) { return x*y/gcd(x,y); } 题目: The

HDU 1222: Wolf and Rabbit

HDU 1222: Wolf and Rabbit ///@author Sycamore, ZJNU ///@accepted_on 2017-01-24 #include<iostream> using namespace std; unsigned gcd(unsigned a, unsigned b) { return b == 0 ? a : gcd(b, a % b); } int main() { int P; cin >> P; while (P--) { unsi

Dire Wolf(区间DP)

Dire Wolf Time Limit: 5000/5000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2221    Accepted Submission(s): 1284 Problem Description Dire wolves, also known as Dark wolves, are extraordinarily large and powerfu

HDU-1222 Wolf and Rabbit (欧几里得定理)

Wolf and Rabbit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7684    Accepted Submission(s): 3870 Problem Description There is a hill with n holes around. The holes are signed from 0 to n-1.

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

Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor. Dire wolves look like normal wolves, but these creatures are of nearly twice the size. These powerf