📄 cylinder.java
字号:
package chapter8;
class Cylinder
{
double radius;
double depth;
Cylinder (double r, double d)
{
this.radius = r;
this.depth = d;
}
public String toString()
{
return " Dimensions are " + this.radius + " by " + this.depth + ".";
}
}
class ToStringDemo
{
public static void main(String args[])
{
Cylinder c = new Cylinder (10, 14);
String s = "Cylinder c: " + c; // concatenate Cylinder object
System.out.println(c); // convert Cylinder to string
System.out.println(s);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -