Person類:
public class Person {
private String name;
private int age;
private double height;
private double weight;
private boolean married;
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public void setMarried(boolean married)
{
this.married = married;
}
public boolean isMarried()
{
return this.married;
}
void drink()
{
}
public void drink(int a)
{
}
public void drink(int a,int b)
{
}
public void drink(int a,double c)
{
}
public Person()
{
}
public Person(int age,String name)
{
this.age = age;
this.name = name;
// this.weight = weight;
// this.height = height;
}
public Person(int age ,String name, double weight, double height)
{
this.age = age;
this.name = name;
this.weight = weight;
this.height = height;
}
public static void main(String[] args) {
Person tmpPerson = new Person();
Person tmpPerson1 = new Person(10,"make",1.0,1.0);
tmpPerson.age = 10;
}
}
Human類:
public class Humen {
public static void main(String[] args) {
Person p = new Person();
Person p1 = new Person(11,"dfa",14.3,90.2);
Person p2 = new Person(11,"rwe");
}
}
遞歸:
public class Test01 {
public static void main(String[] args) {
// someMethod();
otherMethod(1);
}
public static void someMethod()
{
someMethod();
System.out.println("遞歸");
}
public static void otherMethod(int i) {
if(i < 0)
{
System.out.println("結(jié)束");
}
else
{
System.out.println("qqq"+i);
otherMethod(--i);
System.out.println("ddd"+i);
// System.out.println(i);
}
System.out.println(i);
}
//漢諾塔問題
//斐波那契數(shù)列
}