JAVA- basic concepts

  • Identifier
  1. Identifier 26 may comprise letters (case insensitive), numbers 0-9, and _ $ symbol underscore.
  2. Identifiers can not begin with an array.
  3. Identifiers can not be keywords.
  • constant
    • Concept: During the program run, a fixed amount of unchanged
    • classification:
      1. String constants: Any partial double quotation marks, called string constants, such as: "abc", "123"
      2. Integer constants: write directly on the numbers, there is no decimal point. For example: 100, 200, -200
      3. Float constant: to write directly on the numbers, there is a decimal point, for example: 2.5, -3.14,0.0
      4. Character Constants: single quotes to all single character, called the character constants, such as: 'A', '1', 'medium'
      5. Boolean constants: only two values, true false
      6. Empty constants: null, no data on behalf of

   type of data

  Integer byte short int long

  Float float double

  The type char

  Boolean boolean

  Note : The string is not a basic type, but reference types.

     Float may only be an approximation, not a precise value

     Data range is not necessarily related to the number of bytes

     Float among the default type is double, if you want to use a float, the need to add a suffix F,

     If is an integer, the default is int type, long type if you want to use, you need to add a suffix L

 

  variable

    1. Variable names can not be repeated

    2. For float and long types, the character can not be omitted and L suffix F

    3. Start from the line defined variables, until the end of a direct member of the braces so far

  Cast

    1.byte / short / char three types can occur mathematical waybill, such as addition "+"

    2.byte / short / char in the three types of operation that they will first promoted to the int type, and then in the calculation

  ASCII code table

    48 ->'0' 65->'A' 97->'a'

  Compiler optimizations:

    short result = 5 + 8; // the right of the equal sign are constant compiled for all

    short result = 13;

 

Guess you like

Origin www.cnblogs.com/caogaoben/p/10961947.html