摘要: 1.编写一个程序,实现从命令行参数输入两 个字符串类型的数值,并计算输出两个数值的 和。 [必做题] package xhy; import java.util.Scanner; public class Text { public static void main(String[] args) { 阅读全文
posted @ 2023-06-16 01:10 徐慧羽 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1 package xhy; import java.util.Scanner; public interface Fruit{ } class Apple implements Fruit{ public Apple() { System.out.println("创建了一个苹果对象"); } } 阅读全文
posted @ 2023-06-16 01:04 徐慧羽 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1. 设计三个类,分别如下:(知识点:抽象类及抽象方法) [必做题]• 3.1 设计Shape表示图形类,有面积属性area、周长属性per,颜色属性color,有两个构造方法(一个是默认的、一个是为颜色赋值的),还有3个抽象方法,分别是:getArea计算面积、getPer计算周长、showAll 阅读全文
posted @ 2023-06-16 01:00 徐慧羽 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1. package xhy; public class Point { public static class Point{ int x; int y; public Point(int x0, int y0) { super(); this.x=x0; this.y=y0; } public P 阅读全文
posted @ 2023-06-16 00:48 徐慧羽 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1.编写一个方法,实现冒泡排序(由小到大),并调用该方法 package xhy; import java.util.Scanner; public class Text { public static void main(String[] args) { // TODO Auto-generate 阅读全文
posted @ 2023-06-09 09:14 徐慧羽 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1、给定一个有9个整数(1,6,2,3,9,4,5,7,8)的数组,先排序,然后输出排序后的数组的值。 package xhy; import java.util.Arrays; public class app { public static void main(String[] args) { 阅读全文
posted @ 2023-05-06 21:18 徐慧羽 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1.编写一个简单程序,要求数组长度为5,静态赋值10,20,30,40,50,在控制台输出该数组的值。 package xuhuiyu; public class Text { public static void main(String[] args) { // TODO Auto-generat 阅读全文
posted @ 2023-04-15 17:46 徐慧羽 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1.使用for循环计算1-100的和,除了以3结尾的那些数。 package xhy; public class Text { public static void main(String[] args) { // TODO Auto-generated method stub int sum=0; 阅读全文
posted @ 2023-04-15 15:31 徐慧羽 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) 方法一: package xhy; public class Text { public static void main(String[] args) { // TODO Auto-gene 阅读全文
posted @ 2023-04-03 23:20 徐慧羽 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 1、 输入年份月份,输出该月的天数(闰年2月29天,条件参考上机练习1) import java.util.Scanner; public class Main { public static void main(String[] args) { System.out.println("请输入年份: 阅读全文
posted @ 2023-03-30 12:44 徐慧羽 阅读(22) 评论(0) 推荐(0) 编辑