?? overloading.java
字號:
//:c4 :Overloading.java
import java.util.*;
class Tree
{
int height;
Tree()
{
prt("Planting a seeding");
height=0;
}
Tree(int i)
{
prt("Creating a new tree that is "+i+"feet tall");
height=i;
}
void info()
{
prt("Tree is "+height+"feet tall.");
}
void info(String s)
{
prt(s+":Tree is "+height+" feet tall.");
}
static void prt(String s)
{
System.out.println(s);
}
}
public class Overloading
{
public static void main(String[] args)
{
for(int i=0;i<5;i++)
{
Tree t=new Tree(i);
t.info();
t.info("overloading method");
}
new Tree();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -