It 18 Palm second day course summary

Source: Internet
Author: User

Learn the next day of it 18 Palm Java Foundation Course: Learning Content:  Today's main content is the Java Syntax basics: Mainly about the key words in Java (Chinese and English), identifiers, comments related knowledge   Today's focus is   "operator"    related knowledge   and   "process structure of the program" problems:    need help   more knowledge points, each episode has a lot of knowledge points, There's a lot of pressure for beginners who don't have a Java base. So I hope that after the assignment, in the code given in the answer   can   detailed to each key line to give the corresponding comments.    today focuses on the basics of Java Fundamentals: The basic composition of Java meta-:  keywords-identifiers--annotations--constants and variables                operator--statement--function--array keyword-----------[defines the data type of the keyword]class//class interface//interface byte//byte bit: Bit short//short integer  2 byteint //integral type    4 byteslong//Long integer  8 bytesfloat// Floating-point (single-precision) double//double-precision floating-point. char//character   (/t /n also char type) boolean//boolean  false truevoid//null  [define data type   Value   keyword]false       //true         //null//NULL, there is no [keyword used to define Process Control]if//if esel//otherwise switch//branch case//case default//default, (default) while//when:   Loop do//for//for  Loop break//Interrupt continue//continue return//return [access control modifier keyword]private//privateproected//protected public//Public [class function (function)  modifier (modifier)]abstract//abstract final//final static// Static synchronized//Synchronous extends//extension implements//implementation new//new this//current super//superclass, parent class, instanceof//is xxx instance try//try catch     //capture finally   //final throw    //throws throws     //when defining class declarations, throw exceptions package   //package import   //import  exportnative    //local transient//instantaneous, temporary, temporary  persistentasset//assertion identifier----------------custom name rules   English case + numbers + symbols   "_   "$" NOTE: 1. Numbers may not start   2. You cannot use keywords     3.java strictly case-sensitive    4. Try to make sense of Java   Name Specification          package Name: aaa.bbb.ccc.ddd, all lowercase class   :helloworld  --> helloworld, uppercase and lowercase variables and functions for all words: convertstringtoint -->  convertstring2intconvertstr2int -->  In addition to the first word, the first uppercase constant name of the other word: final string brand = "Benz "  XXX_YYY_ZZZ ; all words capitalized, multiple words with" _ "Links   comments-----------------1. Single-line comment//2. Multiline comment/*  */3. Document Comments   /**   *   */ Constants and variables-------------constants are categorized as: 1. positive constant  , all integers 2. Decimal constant, all decimal number 3. Boolean Boolean constants  true  and False4. Character Constants    A number or symbol with the '   identification 5. String Constants    One or more characters with "" to identify 6.null constants   Only one value in time: null positive number main four types of expression: binary  0.1 octal   0-7 decimal  0-9 hex 0-9 a-f   full 16 in 1  0x beginning mainly involves the conversion of the binary:*  negative binary representation    corresponding positive number of binary negation +1 variable variable is a storage area in   memory      The zone has its own name (variable name) type (data type)      The data in this area can vary from one type to the other    variables can be used to keep constant constants of the same type and can be reused. Considerations for using Variables;     variable use range     {}  between      to initialize variable format  :    data types   variable names  =  initialization values       such as  int a =1 ;  data Types  :     basic data Types:primitive             Numerical Type:                integer Type:byte short int long                 floating-point:float double             Character Type:char             Boolean: Boolean       Reference Data Type:             Class:class            Interface:interface             array: [ ] The default type for integers is  :int  decimal for the default type of  double  data type conversion:     Automatic type conversion    byte short char-->int   float--> double    Coercion type conversion   byte i=1;  byte a = (byte)  i +1;*   All data and string  data are automatically converted to the string operator----------------arithmetic operator +  (plus, add, string addition)-  (minus, minus) */%    Take the mold    12%5  for 2   int ++  (pre-  self-increment arithmetic   post-gaga   first operation plus one)--   the same assignment operator = ,+=  , -=, *= , /=, %=int a =1;a=a+1   <---> a+= 1  is the same short s=1;s=s+1;  //the compilation error is reported here   because s+1  is automatically converted to int  type   cannot be assigned to the short type ss+ =1  //is compiled by   because +=  automatically completes a strong-turn operation when assigning s value. Comparison operator: ==      equals  !=     not equals  <       less than  >      greater than  <=     less than or equal to  >=      greater than equals  instanceof   check whether the class is an object logical operator: &    and       |    or  ^    xor   true^false      true !    non- &&   short circuit and  | |    Short circuit or  *  single &   left or false  , right-hand operation  *  Double &&    if left isTrue, by the variable participation operation, if False, the right does not participate in the arithmetic      "|"   and   "| |"   single "&" && "similar   " ^ "  xor   and" | " The difference between   is   true when    result is  false    bitwise operator  <<       Shift left                 (equivalent to multiplying by 2)   1<<1 = 1*2^1 =2 >>      right shift                    Empathy  > >>     Unsigned Right Shift              &       and operations  |       or operations  ^        XOR Operations  ~       anti-code       Bit operation is a direct binary operation         <<   vacancy 0, the removed high position discarded, the vacancy bit 0.        >>   displaced binary highest bit is 0, after right shift, vacant bit 0;        maximum is 1 , the vacancy position is 1.    >>>  shifted binary highest bit either 0 or 1, the vacant bit is filled with 0.     &   bits for & operation, only 1&1 when the result is 1, otherwise it is 0;    |    Bits for  |  operations, only 0 | 0 when the result is 0, otherwise 1;    ^   the same bits  ^   operation, the result is 0;1^1=0 , 0^0=0        different bits  ^  operation result is 1. 1^0=1 , 0^1=1         Ternary operators            format   (conditional expression)  ?   Expression 1:  conditional expression 2;     If the condition is true  the result of the operation is an expression 1;          if the condition is false  the result of the operation is the flow control of the expression 2      program           Judging structure  ------------------   if statements                       3.if  (conditional expression) {   1.   if (True) {                    EXECUTE Statement  ;        EXECUTE statement;      &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;}ELSE&NBSP;IF (conditional expression)  {        }                                    EXECUTE Statement;                                       }......  {                                            EXECUTE Statement;   2.if  (conditional expression) {                 }else{       EXECUTE Statement;     }else{                               EXECUTE Statement;      EXECUTE statement;   }                                              if  statement   Conditional expression Whatever it is, just see if the final structure is true  or false      select structure        switch  (expression) {     case  value 1:           Execute the statement;          break;//depending on the situation. Whether to add break       case  value 2;          EXECUTE statement;          break       ......        default:          EXECUTE Statement;      There are only four types of     break    }     1.switch  statement choices There is no order   between  byte short int char     2.case and default .   Executes the first case ,  without a matching case execution default.        end switch In both cases   ①  encounter break ,  execution to switch statement end                            ②  if the matching case or default does not have a corresponding break  then the program will continue down                            executes, runs the executable statement, knowing that the end of the break  or switch end is encountered.          Cycle Structure

Represents a statement while a for

While statement expression do While statement format

while (conditional expression) do {

{EXECUTE statement;

Execute statement;}while (conditional expression);//execute at least once

}

for (initialization expression; loop condition expression; loop action expression//iteration condition) {EXECUTE statement;//Loop body}

/*

The sequence of two expressions in the 1.for, the initialization expression is read only once, the loop condition is judged to true--> the loop body----------and the loop condition ... Know that the variable defined in the condition 2.for does not meet after the For loop is released//can only be called within the range of for {}

The while loop uses a variable that continues to be used after the end

3.while (True) and for (;;) is the simplest infinite loop//unconditional control loop count


Other process-controlled statements

Break (jump out)

Continue (Continue)//apply to loop structure, continue statement is to end this cycle and continue the next loop

Functional function definition

----------------------

Add//+

Subtract//-

Multiple//*

Divide///

Support for float double long int//overload of function





It 18 Palm second day course summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.