📄 defaultconstructortest2.java
字号:
// initialization/DefaultConstructorTest2.java
// TIJ4 Chapter Initialization, Exercise 4, page 167
/* Add an overloaded constructor to the previous exercise that takes a String argument and prints it along with your message.*/
class Kabayo2 {
Kabayo2() {
System.out.println("isa lang kabayo");
}
Kabayo2(String s) {
System.out.println(s);
}
}
public class DefaultConstructorTest2 {
public static void main(String[] args) {
Kabayo2 k = new Kabayo2();
Kabayo2 k2 = new Kabayo2("tumutugtog ng gitara");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -