📄 constructor.java
字号:
//Constructor in a class
class Box
{
double width;
double height;
double depth;
Box()
{
System.out.println("Constructing a box");
width = 10;
height = 15;
depth = 5;
}
double volume()
{
return width*height*depth;
}
}
class Constructor
{
public static void main(String args[])
{
Box mybox1 = new Box();
double vol;
vol = mybox1.volume();
System.out.println(vol);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -