Java basic Syntax (1)

Source: Internet
Author: User
Tags clear screen

First, Java overview 1.1Java language platform

Figure 1-1 Java language Platform

Note: Developers are the software that installs the Javase platform.

1.2. Cross-platform

Platform: Refers to the operating system (WINDOWS,LINUX,MAC)

Cross-platform: Java programs can run on any operating system, write once and run everywhere

Principle: Implementing a virtual machine JVM that relies on Java for cross-platform use (Java virtual machines)

Figure 1-2 Cross-platform version

1.3JVM JRE JDK Description

-A: What is a JVM

The JVM is a Java Virtual machine (JVM java VM), Java programs need to run on virtual machines, different platforms have their own virtual machines, so the Java language can cross-platform

-B: What is a JRE

Includes the Java Virtual machine (JVM Java) and the core class libraries required by the Java program, etc. if you want to run a well-developed Java program, you only need to install the JRE on your computer.

jre:jvm+ class Library.

-C: What is a JDK

The JDK is available to Java developers, which includes Java development tools and the JRE. So with the JDK installed, you don't have to install the JRE separately.

Development tools: Compilation Tools (Javac.exe) packaging Tools (Jar.exe), etc.

Development tools for Jdk:jre+java.

-D: Why the JDK contains a JRE

Why does the JDK include a JRE?

After the development of the program, you need to run a look at the effect.

The role and relationship of-E:JDK,JRE,JVM

JDK contains JRE and development kit

JRE contains core class libraries and JVMs

Second, Common DOS command 2.1.1 Open the console

–win + R, then cmd enter

2.1.2 Common Commands

–d: Enter drive letter Toggle

–dir (directory): List files and folders in the current directory

–CD (change directory) changes the specified directory (enter the specified directory)

    • Go to CD directory, CD multi-level directory
    • Eg: enter multiple sub-directories: CD a\\b into the B directory;
    • Fallback CD: (Fallback to the top-level directory); cd\ (directly fallback to the root directory)

–CLS: (Clear screen) clear

–exit: Exit DOS command line

Third, Java syntax 3.1, keyword

Overview of the 3.1.1 keyword

– Words that are given a specific meaning by the Java language

3.1.2. Keyword Features

– The letters that make up the keywords are all lowercase

-Common code Editor, for keywords have a special color tag, very intuitive, so we do not need to memorize, in the future learning important keywords will continue to come out.

3.1.3. Examples of keywords

3.2 Constants

3.2.1. Overview of constants

– The amount of value that cannot be changed during program execution

Characteristics of 3.2.2 Constants

– string constants are enclosed in double quotes ("HelloWorld")

– Integer constant all integers (12,-23)

– Decimal constant All decimals (12.34)

– Character constants are enclosed in single quotes (' A ', ' a ', ' 0 ')

– Boolean constants are more specific, only true and false

– Null constant null (commonly used in arrays)

Procedures for 3.2.3 Constants

1 /*2 constant: The amount of value that cannot be changed during the execution of a program3     4 Constant Classification:5 A: string constant "HelloWorld"6 B: integer constant 12,-237 C: decimal constant 12.348 D: Character constant ' a ', ' 0 '9 E: boolean constant True,falseTen F: Empty constant Null (explained later) One */ A  Public classChangliang { -      Public Static voidMain (string[] args) { -         //string Constants theSystem.out.println ("HelloWorld"); -          -         //Integer Constants -SYSTEM.OUT.PRINTLN (12); +System.out.println (-23); -          +         //Decimal Constants ASystem.out.println (12.34); at          -         //Character Constants -System.out.println (' a '); -System.out.println (' 0 '); -          -         //Boolean Constants inSystem.out.println (true); -System.out.println (false); to     } +}

Results of the execution of the program 3-1

Figure 3-1 Executing a constant program result

3.3 Variable 3.3.1 Variable overview

– The amount at which the value can change within a range during program execution

– In essence, a variable is actually a small area of memory

3.3.2 Variable definition Format

– data type variable name = initialization value;

– Note: The format is fixed, remember the format, status quo

3.3.3 variable plots

Java basic Syntax (1)

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.