04 2020 档案
摘要:1、定义一个点类Point,包含2个成员变量x、y分别表示x和y坐标,2个构造器Point()和Point(intx0,y0),以及一个movePoint(int dx,int dy)方法实现点的位置移动,创建两个Point对象p1、p2,分别调用movePoint方法后,打印p1和p2的坐标。[必
阅读全文
摘要:3、定义一个笔记本类,该类有颜色(char)和cpu型号(int)两个属性。 [必做题]• 3.1 无参和有参的两个构造方法;有参构造方法可以在创建对象的同时为每个属性赋值;• 3.2 输出笔记本信息的方法• 3.3 然后编写一个测试类,测试笔记本类的各个方法 package the1; publi
阅读全文
摘要:public class newclass { int length; int width; public void getArea(){ System.out.println("s="+length*width); } public void getPer(){ System.out.printl
阅读全文
摘要:1.有10个评委打分,(去掉一个最高一个最低)求平均分。 package the; import java.util.Scanner; public class newclass { public static void main(String[] args) { // TODO Auto-gene
阅读全文
摘要:1.定义长度位5的整型数组,输入他们的值,用冒泡排序后输出. public class the { public static void main(String[] args) { int a[]=new int[5]; Scanner x=new Scanner(System.in); Syste
阅读全文
摘要:1.编写一个简单程序,要求数组长度为5,静态赋值10,20,30,40,50,在控制台输出该数组的值。 public class the { public static void main(String[] args) { // TODO Auto-generated method stub int
阅读全文
摘要:1. 打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身。例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。(知识点:循环语句、条件语句) package the; public class newcless4 { public st
阅读全文
摘要:1. 分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) package the; public class newcless4{ public static void main(String[] args) { // 分别使用for循环,wh
阅读全文