Summary of the first three chapters of Java

Source: Internet
Author: User
Tags java keywords

The first chapter: 1. What's in Java?

The JDK (Java Development Kit) includes

Jre (Java Runtime Environment)---------->JVM (Java Virtual machine)

Application (JAVAC)

Java API and some common jar packages;

    1. Java benefits: A. Object-oriented; cross-platform/portability for B.java;
    2. Java execution Process: Java source file-------> Compiler-------->.class file--------->JVM explained.

Chapter II:

Variable:

Use a single letter or character to express words. The first thought of char;

String name = "Zhang San";

String name;

Name = "Zhang San";

int age = 18;

int age;

Age = 18;

char sex = ' male ';

char sex;

sex = ' woman '

mathematical operators +;-; *;/;%;+=; + +;--;

+ = is

sum = sum+ (num1+num2) is equivalent to sum+= (NUM1+NUM2)

Logical operator:>;  <;  >=;  <=;  !=; = = (two equals equals an equal sign is an assignment).

|| ;&&;

|| : Two conditions, meet one can be run;

&&: Two conditions are met to run.

identifiers :

    1. Can contain numbers, letters, (_ and $ are not recommended for use);
    2. Cannot begin with a number;
    3. Cannot use Java keywords;
    4. to have meaning;
    5. Hump naming law;
    6. Capitalize the first letter of the class name;

Chapter III:

    1. Select structure: if structure; switch structure
    2. A simple if statement:

If (condition) {

Statement

};

If.......else statements

If (condition) {

}else{

};

If.......else if........else Statements

If (condition) {

}else if (condition) {

}else{

};

switch (expression) {

Case Value:

Break

Case Value:

Break

Case Value:

Break

Doufault:

break;

}

Loop structure:

While do........while for

For loop (fixed for loop count)

for (int i = 0; i< 10; i++) {

}

While is typically used in cases where the number of cycles is unknown;

Summary of the first three chapters of Java

Related Article

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.