java keywords and identifiers (partial types)

Keywords: Java Back-end

1. Keyword

1. What are keywords? Let's get to know:

1. What are keywords:
            Parse: All colors in the compiler are keywords.
          For example, public, void,       Four types and eight types of data (int, long, short, float, double, char, true, flase);


2. Letter case format:
             Parse: Letter lowercase format


3. Color:
             Resolution: The most important feature is that the compiler has a dotted color.     If you don't use a compiler and compile with other things, it's recommended that you install one as soon as possible, but not at all, young people's rat tails...

4. Role:
    Parse 1: Each keyword has a different function to see which one is used, for example:
          a: public     // Modified classes are public, other classes can be used, even if you don't understand them, what you will learn later is just to know, what you can't get is not compelling;
          b:void       // Where in the main method, the return value is empty, even if you don't understand it, you will learn later. Understanding is OK, don't force, you won't be able to rain;

          [   Supplement: main =="   Main is a method, this part of the code must have it to execute, if part of the code does not have it, then it can not execute, this code can not run, although the code part has it, but without this main method, the code part has no meaning;                 // A human figure of speech: Just like your family bought a bunch of firecrackers (part of the code), but without a lighter (main), it's still a dumb gun!!!! Don't miss this year!)


      Parse 2: The following is a good note, (four types and eight data types)

/*
       Integer part
        1.1:int              //Integer keywords, can only use integer values, know what is a value? Have you studied math? Integers are simple, that is=== For example: 123456, 654321, 1, 0, 100 (all integers are called integers)
        1.2:long             //Long integer, the enhanced version of integer, the semantics and integer are similar, but the accuracy is a little longer, the accuracy is the size of the value, no longer know the accuracy, go to Baidu, walk slowly without sending.... (Accuracy terminology: means the number is more detailed)
        1.3: short           //Short integer, reduced version of integer, same semantics as the two above, with less precision
       
       Floating Point Part
        2.1: double          //Floating point (double precision) has decimal points, have you learned mathematics? Numbers with decimal points are called floating-point types, but double-precision lengths are slightly longer (length term: larger numbers)
        2.2: float           //Floating point (single precision) with decimal points is only twice as accurate as double precision;
        
       Character Type Part
        3.1: char            //Character type single quotation marks are called character type. (Note that strings are double quotation marks when distinguished from strings)
        
       Boolean type part: Boolean           
        4.1: true             //True or False
        4.2: flase            //False judgement
*/

Four types and eight types that must be remembered at this stage!!!!!!!!!!

Here are examples of four types and eight types of keywords

//Key Identifier Assignment Numeric Semicolon

//Short integer:
    short c = 10;        //2-byte, 16-bit Short
//Integer:
    int  a = 1000;        //4 bytes, 32 bits, Integer
//Long integer:
    long b = 88888;       //8-byte, 64-bit Long


//Floating Point (Single Precision):
    float f = 6.666f;          //4-byte, 32-bit Float
//Floating Point (Double):
    double d = 88.888888;      //8-byte, 64-bit double


//Character:
    char  ch1 = 'a';           //2-byte, 16-bit Character


//Boolean:
    boolean bl1 = true;        //1-byte, 8-bit Boolean
    boolean bl2 = flase;       //1-byte, 8-bit Boolean

2. What is an identifier

1. Initialization:

one: start with a lowercase letter, in camel mode;         // Of course, capitalization begins with the hump mode! It's not said that you can't use an identifier in camel mode, but it's a little more common to use a small camel.
two: alphabet, number, underscore, dollar sign group;        // But it must begin with a letter;

3:java is unique in uppercase and lowercase English letters, because they represent different meanings and have different effects.

4: To whom is an identifier used: for class name, method name, variable name, package name:
          Class name: The word after each class keyword represents a class, the class of that word, and the class name is that word. One class is a class, two classes are two classes, and so on.
          Method name: Now this stage is the main method, and the word main is the identifier;                 // There will be a variety of ways in the future, overloading, construction, membership..., of course, you can't rain now;
          Variable Name: As far as I know, all variable names are identifiers, trusted or not;
          Package Name: This is a folder in the computer disk. It is called a package here. It contains many classes for easy storage and processing. Of course, it's good to know here. You can't understand anything without knowing it, and you will learn later.

Say so much, code it:

package this_is_a_bao;    //This is a package

public class this_is_a_lei{    //This is a class, class braces are content, must handle events within the class, note: methods in the class, such as the main method, the main method see below explanation, class before the braces, class after a brace back, do not miss the braces!!!

//Note: Braces, parentheses, character''and string'' are all paired, none less!!!!!

public static void main(String[] args){    //This is a method, main method, without which the program can not run, main into the stack, into the stack or that sentence, rain you no longer, remember this method can run, what? What is the method you asked? The parenthesized identifier is the method main()

//Keyword Identifier 
//Integer,
    int i;    //Keyword int, identifier a, means to declare a variable a Note that the declaration has no value;
    i = 888;    //Here we assign 888 to the declared variable a;

    long l;
    l = 1234567;
    
    short s;
    s = 123;

//Floating Point,
    float f;
    f = 1234.1234f;        //Floating-point type defaults to double type, and if float is required, an f is added after it.

    double d;
    d = 857857.857857857;    

//Character type,
    char ch;
    ch = 'a';                //Floating point type, only single quotation mark plus single character, one more hand in quotation mark or one more leg in character are all wrong, I don't believe you can try it;

//Boolean,
    boolean b1;
    b1 = true;                //b1 is correct;
    b1 = flase;               //B1 is wrong, why or b1, and the results are different because of override, what is override? A cup pours a glass of water, whether it is drunk or thrown out, and if you add wine, it is covered up and water no longer exists. Remember at first that the identifier is the container.
}//main brace    
}//Class Back Braces

Here are a few more one-off, code on top:

package emo;    //emo package

class heiheihei{    //heiheihei class

public static void main(String[] args){    //main method
//Key identifier assignment number value;
    int i = 888;

    long l = 8888;

    short s = 88;

    double d = 88888.88888;

    float f = 888.888f;

    char c = 'a';

    boolean bl = true;

    boolean b2 = flase;
}
}

Posted by picker999 on Sun, 31 Oct 2021 15:01:57 -0700