1. 程式人生 > >小貓取經2017-06-23

小貓取經2017-06-23

cat extends ins 長大 之間 name pac test 快樂

package Java.Test;

import java.util.Calendar;

public class Lianxi {

public static void main(String[] args) {
String months[]={"Jan","Feb","Mar","Apr","May","Jun","July","Aug","Sep","Oct","Nov","Dec"};
Calendar cal=Calendar.getInstance();
//System.out.print("Date:");
System.out.print(months[cal.get(Calendar.MONTH)]);
System.out.print("/"+cal.get(Calendar.DATE)+"/");
System.out.print(cal.get(Calendar.YEAR)+",");
double a=Math.random();
int b=(int)(a*10+3);
System.out.print(b);
Cat c=new Cat("克的黃色波斯貓出生了",200.2);
c.Cat1("田帥");
System.out.print("從此它就快樂的生活了,");
Cat I=new Im();
Im I1=(Im)I;
I1.i();
Cat O=new Owener();
Owener O1=(Owener)O;
O1.owner();
}
}
class Cat{
String str;
int age;
double weight;
String name;
Cat(){

}

Cat(String str,double weight){
System.out.print("只體重"+weight+str+",");
}
void Cat1(String name){
System.out.print("主人賜予它"+name+"的大名,");
}
}
class Owener extends Cat{
void owner(){
System.out.println("指點了它,給它講述了它來到這個世界的目的,它是帶著遠大的使命來幫人類渡劫的,它聽了之後,似乎一夜之間長大了,第二天它就向主人辭行,");
System.out.print("踏上了去往印度取經的道路,一路上它經歷各種坎坷,翻山越嶺,在來到到達目的地之前的最後一個國度(女兒國)時,");
System.out.println("它淪陷了,它被美色所迷惑,");
System.out.print("忘記了自己的使命,紙醉金迷,在它臨行前,高人指點過它,切不可耽誤行程,否則它將灰飛煙滅,沈迷三月之後,它終被自己的貪婪至於萬劫不復!");
}
void owner2(){

}
}
class Im extends Cat{
void i(){
System.out.println("等到它過百天的時候,來了一位世外高人,");

}
}

小貓取經2017-06-23