zoukankan      html  css  js  c++  java
  • 第一次总结

          一. 初识java

        1. java图标认识

          java     c#     javaEE    .NET

        2.认识java程序结构

         public class HelloWorld {          //编写程序框架

         public static void main(String [] args){        //编写main()方法的框架

         System.out.pritn(" ");

             }

               }

           二.变量,数据类型和运算符

          1.变量名有

            _myCar  (变量必须以字母,下划线"_"或"$"字符开头)

            scorel   (变量可以包括数字,但不能以数字开头)

            $myCar   (除了"_"或"$"符号以外,变量名不能包含任何特殊字符)

            graphl_l    (不能使用java语言的关键字,如int class public等)

          

          2.数据类型有

           int (整型)

           double (双精度浮点型)                    double score =98.5;  //声明score储存分数   98.5

           char (字符型)                                char sex ='男';   //声明性别   男

           String (字符串型)                            String name ="张三";  //声明学生姓名   张三

         

           3.常用运算符列如

            "+"              ">"            "&&"              

            "-"               "<"             "||"

            "*"               ">="           "!"    

            "/"                "<=" 

            "%"              "=="     

                                "!="

           三.选择结构

           1.if结构

               (1)事例:

                      import java.util.Scanner;

                    public class Demo{

                       public static void main(String [] args){

                       Scanner input = new Scanner (System.in );       

                              int 赋值 = input.nextInt;

                             System.out.pritn(".....");

                               if( 条件 ){

                                   System.out.pritn(".....");

                                   }

                                           System.out.pritn(".....");

                                }

                          }

             2. if  else 结构

               (2)事例:

                    public class Demo{

                       public static void main(String [] args){

                          int   i =91;  //张浩的成绩

                         if( i >98) {

                            System.out.pritnln("就奖励一个mp4!");

                            } else {

                           System.out.println("惩罚编写代码");

                  }

                        }

                       } 

               3.多重if结构

                 (3)事例:

                    public class DemoA{

                       public static void main(String [] args){

                           int score = 70;      // 考试成绩

                            if(score>=80){

                          System.out.println("良好");

                           }else  if(score>=60) {

                             System.out.println("中等");

                           }else {

                                System.out.println("差");

                                       } 

                                                       }    

                                               }

             4.嵌套if结构

                  (4)事例:

                     import java.util.Scanner;

                     public class Demo{

                        public static void main(String [] args){

                             Scanner input = new Scanner(System.in);

                        System.out.print("请输入比赛成绩");

                          double score = input.nextDouble();

                          System.out.print("请输入性别");

                          String gender = input.next();

                   if (score<=10){

                            if(gender.equals('男')){

                      System.out.println("进入男子组决赛");

                          }else if(gender.equals('女')){

                            System.out.println("进入女子组决赛");

                       }

                           }else {

                      System.out.print("淘汰");

                                  }

                                       }

                               }

                四.switch选择结构

                       1.事例:

                       public class Demo{

                     public static void main(String [] args){

                           int nums =1;

                          switch(nums){

                                  case:1

                                      System.out.println(" ......  ");

                                      break;

                            

                                    case:2

                                      System.out.println(" ......  ");

                                      break;

                                   case:3

                                      System.out.println(" ......  ");

                                      break;

                                       default:

                                               System.out.println(" ......  ");

                                      break;

                                  }

                                          }

                                                 }    

           

                 

            

            

            

              

  • 相关阅读:
    百度面试题
    京东2014年招聘会成都站笔试经历
    把一个字符串的大写字母放到字符串的后面,各个字符的相对位置不变,不能申请额外的空间
    POJ 2234 Matches Game
    POJ 3903 Stock Exchange
    POJ 2853 Sequence Sum Possibilities
    POJ 3519 Minimal Backgammon
    POJ 2096 Collecting Bugs
    POJ 3071 Football
    HDU 1175 连连看
  • 原文地址:https://www.cnblogs.com/zdddj/p/6684709.html
Copyright © 2011-2022 走看看