主页 > 三维设计 > 按要求编写Java应用程序?

按要求编写Java应用程序?

2022-08-22 20:18来源:m.sf1369.com作者:宇宇

package pack1;

public class A {

private int i;

float f;

public double d;

}

package pack1;

public class B {

public static void main(String args[]){

A a=new A();

a.f=2;

a.d=3;

}

}

package pack2;

public class B {

public void f(){

System.out.println(执行pack2包中的类B的方法f);

}

}

package pack2;

import pack1.A;

public class C {

public static void main(String args[]){

A a=new A();

B b=new B();

b.f();

a.d=3;

}

}

按要求编写一个Java应用程序程序?

interface CanFly{

public void fly();}

class Plane implements CanFly{

public void fly(){

System.out.println(Plane fly);

}

}

class Bird implements CanFly{

public void fly(){

System.out.println(Bird fly);

}

}

public class Test{

public static void main(String[] args){

Plane p = new Plane();

Bird b = new Bird();

new Test().makeFly(p,b);

}

void makeFly(Plane p,Bird b){

p.fly();

b.fly();

}

}

相关推荐

3D,ae等大型渲染设计制作用机

三维设计 2024-01-12

clo 3d试衣软件有用吗?

三维设计 2023-12-27

2015年数学全国卷选择题答案

三维设计 2023-12-04

韩寒对徐志摩的看法?

三维设计 2023-11-29

3D游戏画面怎么设计的?

三维设计 2023-11-29