color.java
来自「西电科大的基于java面向对象教程」· Java 代码 · 共 48 行
JAVA
48 行
class Color{
int red;
int green;
int blue;
public Color(int red,int green,int blue){
this.red=red;
this.green=green;
this.blue=blue;
}
public void setRed(int red){
this.red=red;
}
public void setGreen(int green){
this.green=green;
}
public void setBlue(int blue){
this.blue=blue;
}
public void display(){
System.out.println("red:"+red);
System.out.println("green:"+green);
System.out.println("blue:"+blue);
}
/*
//copy constructor
public Color(Color other){
red=other.red;
green=other.green;
blue=other.blue;
}
//clone method
public Color clone(){
Color obj=null;
try{
obj=(Color)super.clone();
}
catch(Exception e){
e.printStackTrace();
obj=null;
}
return obj;
//return new Color(red,green,blue);
}
*/
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?