⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 color.java

📁 西电科大的基于java面向对象教程
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -