首页 > 代码库 > 小猫取经2017-06-23
小猫取经2017-06-23
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