javaÌ⣡
Java code:
package f;
public class TestStudent {
public static void main(String[] args) {
Student s1 = new Student();//´´½¨¸¸Àà¶ÔÏó
Xue x1 = new Xue();//´´½¨×ÓÀà¶ÔÏó;
s1.Set("ÕÅÈý ", "ÄÐ ");
s1.Set(18);
s1.Set(88.8);
System.out.println(s1.Info());
x1.Set("ÀîËÄ ","ÄÐ ");
x1.Set("³øÊ¦");
x1.Set(18);
x1.Set(99.9);
System.out.println(x1.Info());
Student s2 = new Xue();
s2.Set("СÍõ","Å®");
s2.Set(26);
s2.Set(33.3);
}
}
class Student{ //¸¸Àà
String name;
String xingbie;
int age;
double chengji;
public void Set(String name,String xingbie){
this.name = name;
this.xingbie = xingbie;
}
public void Set(int age){
this.age = age;
}
public void Set(double chengji){
this.chengji = chengji;
}
public String GetName(){
return name;
}
public String GetXingBie(){
return xingbie;
}
public int GetAge(){
return age;
}
public double GetChengJi(){
return chengji;
}
public String Info(){
return "Ãû×Ö:" + name + "ÐÔ±ð:" + xingbie + "ÄêÁä:" + " " + age + " " + "³É¼¨:" + chengji;
}
}
class Xue extends Student{ //×ÓÀà ¼¯³ÉÁ˸¸Àà
String zhiwu;
public void Set(String zhiwu){
this.zhiwu = zhiwu;
}
public String GetZhiWu()
Ïà¹ØÎÊ´ð£º
ÏÖÔÚ»¹ÓкܶàÈ˸㲻¶®PHPºÍJAVA¿ª·¢µÄÐͬOAµ½µ×ÓÐʲô²»Í¬£¬¶Ô×Ô¼ºµ½µ×ÓÐʲôӰÏ죬ÒÔÖÁÓÚ×ö³öÁË´íÎóµÄÑ¡Ôñ¶øêݺ¦ÎÞÇî¡£±ÊÕ߸ù¾ÝÁ½ÖÖ¼¼ÊõµÄÌØµãÖØÐÂÕûÀíÁËÒ»¸ö¶Ô±È£¬¸ø¹ØÐÄÐͬOA¼¼ÊõµÄ¶ÁÕß×ö¸ö²Î¿¼¡£
»ªÌ춯Á¦Ð ......
1 public class BirthDate {
2 private int day;
3 private int month;
4 private int year;
5
6 public BirthDate (){}
7
8 public BirthDate (int d,int m,int y){
9 day = d;
......
import java.io.*;
class FileTest
{
public static void main(String [] args) throws Exception
{
File fDir=new File(File.separator);
String strFile="javaÔ´´úÂë²âÊÔ"+File.separato ......