摘要: 1、编写一个程序,实现从命令行参数输入两个字符串类型的数值,并计算输出两个数值的和。 [必做题] import java.util.Scanner; public class one { public static void main(String[] args) { Scanner sc = ne 阅读全文
posted @ 2023-06-30 13:16 owxd 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1.利用接口实现动态的创建对象[选做题] • 5.1 创建4个类: • 苹果 • 香蕉 • 葡萄 • 园丁 • 5.2 在三种水果的构造方法中打印一句话. • 以苹果类为例 package rrrr; public interface Fruit { class apple implements F 阅读全文
posted @ 2023-06-30 13:14 owxd 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1、给定一个有9个整数(1,6,2,3,9,4,5,7,8)的数组,先排序,然后输出排序后的数组的值 import java.util.Arrays; public class asdjk { public static void main(String[] args) { // TODO Auto 阅读全文
posted @ 2023-06-30 13:10 owxd 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个点类Point,包含2个成员变量x、y分别表示x和y坐标,2个构造器Point()和Point(intx0,y0),以及一个movePoint(intdx,intdy)方法实现点的位置移动,创建两个Point对象p1、p2,分别调用movePoint方法后,打印p1和p2的坐标。[必作题 阅读全文
posted @ 2023-06-30 13:04 owxd 阅读(11) 评论(0) 推荐(0) 编辑
摘要: package seven; public class seven { public static void main(String[] args) { // TODO Auto-generated method stub int a[]={5,6,8,2,5,9}; sort(a); for(in 阅读全文
posted @ 2023-06-30 13:01 owxd 阅读(5) 评论(0) 推荐(0) 编辑
摘要: public static void main(String[] args) { // TODO Auto-generated method stub int a[] = {2,4,6,4,8,9,2 }; System.out.println("Arrays.sort排序:"); Arrays.s 阅读全文
posted @ 2023-06-30 12:58 owxd 阅读(5) 评论(0) 推荐(0) 编辑