- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 myeclipse中用方法名进行冒泡排序
package text; public class maopao { public static void main(String[] args) { int [] arr = {2,1,3,7,6};//定义数组,赋值无序 System.out.println("冒泡排序前:"); pintArray(arr);//打印你数组元素 bubbleSort(arr);//调用排序的方法 System.out.print...
2021-07-04 18:28:53
115
原创 myeclipse的方法重载
public class i { public static void main(String[] args) { //求和调用 int sum1 = add(4,7); int sum2 = add(1,4,5); double sum3 = add(1.2,3.9); //打印结果 System.out.println("sum1="+sum1); System.out.println("sum2="+...
2021-07-04 14:42:11
112
原创 myeclipse调用方法实现打印矩形
package text; /* * 使用方法实现打印三个长宽不同的矩形 */ public class fangfa1 { public static void main(String[] args) { printRectangle(3,5);//调用printRectangle实现打印矩形 printRectangle(5,12); printRectangle(9,25); } //下面定义了一个打印矩形的方法,接收两个参数,其中heigth表示高...
2021-07-04 14:07:46
783
1
原创 myeclipse利用循环嵌套实现猜字游戏
package text; import java.util.Random; import java.util.Scanner; /* * 猜字游戏 */ public class text2 { public static void main(String[] args) { //1.通过random类中的nextInt(n)方法,生成一个0~9之间的随机数 int randomNumber =new Random().nextInt(10); ...
2021-07-04 12:07:49
285
原创 myeclipse打印直角三角形
package text; public class text2 { public static void main(String[] args) { int i,j; for(i=1;i<=9;i++) { for(j=1;j<=i;j++) { System.out.print("*"); } System....
2021-07-04 11:15:41
157
原创 myeclipse中的switch语句表示星期
package text; public class switch1 { public static void main(String[] args) { int week = 8; switch (week){ case 1: System.out.println("星期一"); break; case 2: System.out.println("星期二");...
2021-07-03 17:00:58
184
原创 myeclipse:商城库存清单程序设计
package text; /* * 商城库存清单案例 * 变量的形式对商品的数据保存 * 品牌、尺寸大小、价格、配置、库存数量 * 三个品牌 苹果,thinkpad,华硕 * 计算出总量的库存数量和商品的总金额 */ public class text1 { public static void main(String[] args) { //苹果笔记本 String macBeard = "MacBookAir"; ...
2021-07-03 15:56:42
587
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人