您的位置:

关于java的eagle的信息

本文目录一览:

java对文件名的几个操作,获取文件扩展名,去掉扩展名

/*

 * Java文件操作 获取文件扩展名

 *

 *  Created on: 2011-8-2

 *      Author: blueeagle

 */

    public static String getExtensionName(String filename) { 

        if ((filename != null)  (filename.length()  0)) { 

            int dot = filename.lastIndexOf('.'); 

            if ((dot -1)  (dot  (filename.length() - 1))) { 

                return filename.substring(dot + 1); 

            } 

        } 

        return filename; 

    } 

/*

 * Java文件操作 获取不带扩展名的文件名

 *

 *  Created on: 2011-8-2

 *      Author: blueeagle

 */

    public static String getFileNameNoEx(String filename) { 

        if ((filename != null)  (filename.length()  0)) { 

            int dot = filename.lastIndexOf('.'); 

            if ((dot -1)  (dot  (filename.length()))) { 

                return filename.substring(0, dot); 

            } 

        } 

        return filename; 

    }

anm.java:36: 错误: eagle不是抽象的, 并且未覆盖aif中的抽象方法climbtree() class eagle extends anima

你的eagle类实现了aif接口,但是没有重写aif接口中的climbtree方法,cat类也是,没有重写aif接口中的fly方法,接口中的方法是必须全部被实现类重写的

kafka-eagle安装踩坑

1.遇到的第一个坑是启动eagle失败,查看logs/error.log和ke_console.out才知道是虚拟机内存不足,java虚拟机需要1G内存,而虚拟机本身才有1G

解决办法:直接修改虚拟机内存

2.JMXConnector报错,在kafka下面的kafka-server-start.sh文件里添加 jmx端口9999

3.mysql服务器连接一直报错

java编写Animal类

//接口的定义

interface Animal {

public void bark();

public void fly();

}

//老鹰类

class Eagle implements Animal {

public void bark() {

System.out.println("老鹰叫");

}

public void fly() {

System.out.println("老鹰飞");

}

}

//鸽子类

class Pigeon implements Animal{

public void bark() {

System.out.println("鸽子叫");

}

public void fly() {

System.out.println("鸽子飞");

}

}

//测试类

public class Test{

public static void main(String[] args){

Animal pigeon = new Pigeon();

Animal eagle = new Eagle();

pigeon.bark();

pigeon.fly();

eagle.bark();

eagle.fly();

}

}

如果还有什么疑问..请百度Hi我.. 我会进一步的为你解答..

java 怎么用命令进入指定的目录

这个跟java没关系,完全是dos命令

在dos里输入 c: 回车,就到C盘了,其他类似

如果C盘下有abc文件夹,输入cd abc 就可以进去了,cd就是进入文件夹的命令

cd..是退回到上一层目录

cd/ 是退回到根目录

一道JAVA题,在线等答案,求高手帮忙~

public class Test {

public static void main(String[] args) {

IBird chicken1 = new Chicken("Chicken 1", "Red", 3.5F);

IBird chicken2 = new Chicken("Chicken 1", "Green", 11.5F);

IBird chicken3 = new Chicken("Chicken 1", "Blue", 7.5F);

IBird eagle1 = new Eagle("Eagle 1", "Black", 100F);

IBird eagle2 = new Eagle("Eagle 2", "White", 35F);

System.out.println("Chicken 1 can reach 10 height? " + chicken1.isReachable(10));

System.out.println("Chicken 2 can reach 10 height? " + chicken2.isReachable(10));

System.out.println("Chicken 3 can reach 10 height? " + chicken3.isReachable(10));

System.out.println("Eagle 1 can reach 10 height? " + eagle1.isReachable(10));

System.out.println("Eagle 2 can reach 10 height? " + eagle2.isReachable(10));

if(chicken1.isReachable(10F)){

chicken1.printBirdInformation();

}

if(chicken2.isReachable(10F)){

chicken2.printBirdInformation();

}

if(chicken3.isReachable(10F)){

chicken3.printBirdInformation();

}

if(eagle1.isReachable(10F)){

eagle1.printBirdInformation();

}

if(eagle2.isReachable(10F)){

eagle2.printBirdInformation();

}

}

}

interface IBird{

public void setName(String name);

public void setColor(String color);

public void setMaxFlyingHeight(float height);

public boolean isReachable(float height);

public void printBirdInformation();

}

class Chicken implements IBird{

private String name;

private String color;

private float maxFlyingHeight;

private int eggs;

public Chicken(String name, String color, float maxFlyingHeight){

this.name = name;

this.color = color;

this.maxFlyingHeight = maxFlyingHeight;

}

public int getEggs() {

return eggs;

}

public void setEggs(int eggs) {

this.eggs = eggs;

}

public boolean isReachable(float height) {

return height = maxFlyingHeight;

}

public void printBirdInformation() {

System.out.println("Chicken's information: name: " + this.name + ", color: " + this.color);

}

public void setColor(String color) {

this.color = color;

}

public void setMaxFlyingHeight(float height) {

this.maxFlyingHeight = height;

}

public void setName(String name) {

this.name = name;

}

}

class Eagle implements IBird{

private String name;

private String color;

private float maxFlyingHeight;

private double flyingDistance;

public Eagle(String name, String color, float maxFlyingHeight){

this.name = name;

this.color = color;

this.maxFlyingHeight = maxFlyingHeight;

}

public double getFlyingDistance() {

return flyingDistance;

}

public void setFlyingDistance(double flyingDistance) {

this.flyingDistance = flyingDistance;

}

public boolean isReachable(float height) {

return height = maxFlyingHeight;

}

public void printBirdInformation() {

System.out.println("Eagle's information: name: " + this.name + ", color: " + this.color);

}

public void setColor(String color) {

this.color = color;

}

public void setMaxFlyingHeight(float height) {

this.maxFlyingHeight = height;

}

public void setName(String name) {

this.name = name;

}

}