public abstract class account {
private double balance;
public abstract double getInterest(double index,double time);
public account(double balance) {
this.balance = balance;
}
public account() {
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
}
public abstract class account {
private double balance;
public abstract double getInterest(double index,double time);
public account(double balance) {
this.balance = balance;
}
public account() {
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
}
public class accounttest {
public static void main(String[] args) {
account account = new fixeaccount(1000);
System.out.println("本金:" + account.getBalance() + " 利息:" + account.getInterest(0.003,1));
}
}
public class animal {
private String name;
private String color;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public animal() {
}
public animal(String name, String color) {
this.name = name;
this.color = color;
}
public void show(){
System.out.println("名字叫"+ name +"颜色是:" + color);
}
}
public class dog extends animal{
private int toothNumber;
public dog() {
}
public dog(int toothNumber) {
this.toothNumber = toothNumber;
}
public dog(String name, String color, int toothNumber) {
super(name, color);
this.toothNumber = toothNumber;
}
@Override
public void show(){
super.show();
System.out.println("牙齿数量:" + toothNumber);
}
}
public class dogTest {
public static void main(String[] args) {
dog dog1 = new dog();
dog1.show();
dog dog2 = new dog("亚力"+" ","棕色",24);
dog2.show();
}
}
public abstract class person {
String name;
int age;
double height;
public person(){
System.out.println("无参构造被调用了");
}
public void show(){
System.out.println("我是Person...show()");
}
public abstract void say();
}
public abstract class Student extends person{
public Student() {
System.out.println("无参构造被调用");
}
@Override
public void show(){
System.out.println("我是Person...show()");
}
@Override
public void say(){}
}
public class persontest {
public static void main(String[] args) {
Student student = new Student() {
};
}
}
public class person01 {
String name;
int age;
public person01() {
}
public person01(String name, int age) {
this.name = name;
this.age = age;
}
public void show(){
System.out.println("姓名:" + "年龄;");
}
}
public class worker extends person01{
double salary;
@Override
public void show(){
System.out.println("薪水:");
}
}
public class personworkertest {
public static void main(String[] args) {
person01 person01 = new person01();
person01.show();
worker worker = new worker();
worker.show();
person01 person011 = new worker();
person011.show();
}
}
public interface runner {
void running();
}
public interface hunter extends runner{
void hunt();
}
public class Chinese implements hunter{
@Override
public void hunt() {
System.out.println("抓住一只小白兔");
}
@Override
public void running() {
System.out.println("正在全力奔跑");
}
}
public class ChineseTest {
public static void main(String[] args) {
runner runner = new Chinese();
runner.running();
hunter hunter = new Chinese();
hunter.hunt();
}
}
public class Person {
private String name;
private int age;
private void eat(){}
private void play(){};
}
public class Student extends Person{
public Student() {
super();
}
public Student(int studentID) {
this.StudentID = studentID;
}
public Student(String name,int age,int studentID){
super();
this.StudentID=studentID;
}
private int StudentID;
private void study(){}
}
public class Teacher {
private int TeacherID;
private void speak(){}
}
public class Worker {
private double salary;
private void working(){}
}