- 博客(9)
- 收藏
- 关注
原创 操作二维数组——列数相同、列数不同
1、二维数组——列数相同public class Dasanyuan { public static void main(String[] args){ /** * 1.操作二维数组(列数相同) */ int sum =0,sum1 = 0; int chinese = 0; int math = 0; //定义一个三行两列的整型二维数组in
2017-10-25 10:00:29
2629
原创 使用三目运算符
int a = 10, b = 7; int max; max = a>b?a:b; System.out.println(max); boolean b1 = a>b?(3<6|3<1):(true == false); System.out.println(b1);运行结果:10true
2017-10-25 09:58:55
741
原创 求元音字母
//定义一个字符变量并初始化 Scanner a2 = new Scanner(System.in); System.out.println("请输入一个元音字母:"); char ch = a2.next().charAt(0);//从键盘接收字符型数据 //使用switch结构判断是否为元音字母,并输出对应的信息 switch(ch){ case '
2017-10-25 09:55:57
784
原创 求平方和
//定义整型变量n作为循环变量,并初始化 int n = 0; //定义整型变量sum存放和,并初始化 int sum = 0; //使用while循环求1到5的平方和 while(n<=5){ // sum = (int) (sum+Math.pow( n,2));
2017-10-25 09:52:25
1485
原创 求个位、十位、百位上的数字
public class Dasanyuan { public static void main(String[] args){ //定义变量ge、shi、bai,用于存放个位、十位、百位上的数字 int ge ; int shi; int bai; int max=300; int min=200;
2017-10-25 09:49:58
11574
原创 冒泡排序
public class Dasanyuan { public static void main(String[] args){ //冒泡排序 int[] a= {25,54,69,8,7,456,36,47}; int temp; for(int i=0;i<a.length-1;i++) { for(int j=0;j<a.length-i-1;j++) { if(a
2017-10-25 09:44:28
238
原创 打印直角三角形,等腰三角形、直角梯形、等腰梯形
public class Dasanyuan { public static void main(String[] args){ /** * 打印直角三角形 */ final int row = 5;//要打印几行 for(int i=1;i<=row;i++){ //负责打印一个由星号组成的等腰直角三角形 for(int k=0;k<i;k++){
2017-10-25 09:38:44
4506
原创 求圆、长方形的面积
public class DisCountDemo { //求圆形面积 public double S(double r){ double syuan = Math.PI*r*r; return syuan; } //求长方形面积 public double S(int a,int b){ double schang = a*b; return sch
2017-10-25 09:18:46
1029
原创 小白求大神帮忙看看这个空指针异常!!改来改去都不对!!要哭了...简易扑克牌游戏....
package com.immoc.poker_game;/** *创建扑克牌类 *纸牌类包含:1.属性: 花色、点数 */public class Cards { public String suit;//纸牌花色 public String points;//纸牌点数 /* * 在构造器中初始化属性 */ public Cards(String suit,St
2017-10-19 17:13:55
501
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人