摘要:
编写一个程序,实现从命令行参数输入两 个字符串类型的数值,并计算输出两个数值的 和。 [必做题] package ass; import java.util.Scanner; public class ass { public static void main(String[] args) { Sc 阅读全文
摘要:
5、利用接口实现动态的创建对象[选做题] • 5.1 创建4个类:苹果、香蕉、葡萄、园丁 • 5.2 在三种水果的构造方法中打印一句话.以苹果类为例 class apple { public apple() { System.out.println(―创建了一个苹果类的对象‖); } } • 5.3 阅读全文
摘要:
定义一个点类Point,包含2个成员变量x、y分 别表示x和y坐标,2个构造器Point()和Point(int x0,y0),以及一个movePoint(int dx,int dy)方法实 现点的位置移动,创建两个Point对象p1、p2,分 别调用movePoint方法后,打印p1和p2的坐标。 阅读全文
摘要:
定义一个点类Point,包含2个成员变量x、y分别表示x和y坐标,2个构造器Point()和Point(intx0,y0),以及一个movePoint(intdx,intdy)方法实现点的位置移动,创建两个Point对象p1、p2,分别调用movePoint方法后,打印p1和p2的坐标。[必作题] 阅读全文
摘要:
1.编写一个方法,实现冒泡排序(由小到大),并调用该方法 package kde7; public class Gba { public static void main(String[] args) { // TODO Auto-generated method stub int x[]= {1, 阅读全文
摘要:
给定一个有9个整数(1,6,2,3,9,4,5,7,8)的数组,先排序,然后输出排序后的数组的值。 package vfr; public class Tms { public static void main(String[] args) { // TODO Auto-generated meth 阅读全文
摘要:
编写一个简单程序,要求数组长度为5,静态赋值10,20,30,40,50,在控制台输出该数组的值 package wen; public class Test { public static void main(String[] args) { // TODO Auto-generated meth 阅读全文
摘要:
使用for循环计算1-100的和,除了以3结尾的那些数 package wen; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub int sum = 0; 阅读全文
摘要:
分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) For循环: package shg; public class Agvt { public static void main(String[] args) {// TODO Auto-gen 阅读全文