zoukankan      html  css  js  c++  java
  • 讲义解析

          int     整数       示例用法:   int    score=90;         int  score=input.nextInt();

          double    双精度浮点型    示例用法 :   double    score=0.0;     double   score=input.nextDouble();

          char       字符型      示例用法:   char    gender=input.next.charAt(0);

          String    字符串型        String      name=input.next();

         同一文件里,变量名不能重复

         变量名规则:

          (1):必须以字母,下划线"_",和"$"符号开始.

          (2):不能以数字开始.

          (3):不能使用JAVA关键字.

         合法变量名:  _myCar   score1    $myCar    graph1_1

            

        选择结构1:

           //语句一;

           //语句二;

         if( 条件 ){

         //语句三;

        }

       //语句四

    }

    }//示例之前有

      选择结构二:

     switch// 前篇示例有

    循环结构:

    public class Test09 {
     public static void main(String[] args) {
      int i = 1;
      while (i <= 100) {
       System.out.println("好好学习");
       i++;
      }

     }

     

    字类循环:

    import java.util.Scanner;


    public class Test09 {
     public static void main(String[] args) {
      String answer;
      Scanner input=new Scanner(System.in);
          System.out.println("合格了吗?(y/n)");
           answer=input.next();
           while(!"y".equals(answer)){
            System.out.println("上午阅读代码");
            System.out.println("下午书写代码");
            System.out.println("合格了吗?(y/n)");
               answer=input.next();
           }
           System.out.println("合格");
     }
    }

      

      

     

  • 相关阅读:
    IE11浏览器:请不要再叫我IE,谢谢
    Hadoop HA高可用搭建流程
    YARN
    MapReduce
    HDFS
    shell
    shell总结
    linux总结
    maven+log4j
    Spring
  • 原文地址:https://www.cnblogs.com/LWLDD/p/6684963.html
Copyright © 2011-2022 走看看