曦~妍 |
|
||
2016年5月17日
摘要:
1 // 编写Java应用程序。首先,定义一个时钟类——Clock,它包括三个int型 2 //成员变量分别表示时、分、秒,一个构造方法用于对三个成员变量(时、分、秒) 3 //进行初始化,还有一个成员方法show()用于显示时钟对象的时间。其次,再定义 4 //一个主类——TestClass,在主类的mai... 阅读全文
摘要:
1 String zhanghu;//定义账户 2 double cunkuanyue;//定义存款余额 3 Account(String zhanghu,double cunkuanyue)//初始化账户,存款余额 4 { 5 //this. 代表当前类 6 this.zhanghu=zhanghu; 7 thi... 阅读全文
摘要:
1 Ladder ladder=new Ladder(2,4,6); 2 System.out.println("上底下底高分别是2,4,6的梯形的面积为:"+ladder.getm()); 方法二: 阅读全文
2016年5月16日
摘要:
1 // 编写西游记人物类(XiYouJiRenWu)其中属性有: 2 // 身高(height),名字(name),武器(weapon) 3 // 方法有:显示名字(printName),显示武器(printWeapon) 4 String Name; 5 int Height; 6 String 阅读全文
摘要:
1 Scanner sc=new Scanner(System.in); 2 int[] arr=new int[3]; 3 for(int i=0;iarr[i]) 13 { 14 int zhong=arr[i]; 15 arr[i]=arr[j]; 16... 阅读全文
摘要:
1 //有1、2、3、4四个数字,能组成多少个互不相同且无重复数字的三位数?都是多少 2 int count=0; 3 int a,b,c=0; 4 for(int i=0;i<4;i++) 5 { 6 for(int j=0;j<4;j++) 7 { 8 ... 阅读全文
摘要:
1 double height = 100;// 高度100米 2 double fantan = height / 2; //第反弹反弹高度 3 int i = 0; 4 for (i = 2;i<= 10;i ++){ 5 height = height + fantan * 2; //第i落经少米 6 ... 阅读全文
摘要:
1 //利用条件运算符的嵌套来完成此题:学习成绩> =90分的同学用A表示, 2 //60-89分之间的用B表示,60分以下的用C表示。 3 Scanner sc=new Scanner(System.in); 4 System.out.println("请输入一个数:"); 5 double chengji=sc.nex... 阅读全文
2016年5月13日
摘要:
1 String str="asdfghjklzxcvbnmqwertyuiop"; 2 if(str.indexOf("asd")==0); 3 { 4 System.out.println("判断字符串的开头为:"+str.indexOf("asd")); 5 } 6 System.out.println("判断字符... 阅读全文
摘要:
二次输出: 阅读全文
|
Copyright © 2024 曦~妍
Powered by .NET 8.0 on Kubernetes |