package com.etc.dangqianduixiang;
/**
* 用Screen表示一个屏幕,width,height 表示宽和高。写一个方法pixel()计算它的像数
*/
public class Screen {
public int width;
public int height;
public int pixel()
{
int result = this.height*this.width;
return result;
}
}
package com.etc.dangqianduixiang;
public class ScreenM {
public static void main(String[] args) {
Screen s = new Screen();
s.width = 1366;
s.height = 768;
int p = s.pixel();
System.out.println("像素:" + p);
Screen s2 = new Screen();
s2.width = 1920;
s2.height = 1080;
int q = s2.pixel();
System.out.println("像素 :" + q);
}
}
package com.etc.dangqianduixiang;/** * 用Screen表示一个屏幕,width,height 表示宽和高。写一个方法pixel()计算它的像数 */public class Screen { public int width; public int height; public int pixel() { int result = this.height*this.width; return