four.java
来自「学习算法写的经典算法程序」· Java 代码 · 共 27 行
JAVA
27 行
public class four {
static int count=0;
final int i=5;
int petalCount = 0;
String s = new String("null");
Flower(String s, int petals) {
petalCount = petals;
this.s = s; //
System.out.println("String & int args");
}
Flower() {
this("hi", 47);
System.out.println("default constructor (no args)");
count++;
}
void print() {
System.out.println("petalCount = " + petalCount + " s = "+ s +" count="+count +"i ="+i);
}
public static void main(String[] args) {
Flower x = new Flower();
x.print();
Flower y = new Flower();
y.print();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?