Java Basic syntax

Source: Internet
Author: User

Tag: Eee Zed extends character type calculation import default RAC long

1. Identifiers, Keywords

Identifiers are used in the program to define names, such as file names, class names, method names, or variable names.

In Java, identifiers are defined in the form of letters, numbers, _ (underscores), $,

Which cannot be repeated,

Cannot start with a number,

Cannot be a keyword in Java,

And each identifier must have its own meaning, such as studentname, that is, the name of the student.

Note : Identifiers are case-sensitive.

Such as:

Oracle,oracle,oracle, while representing the same words, but all belong to different identifiers.

It is recommended that identifiers always start with letters and try not to include other symbols;

keywords in Java

Abstract indicates that a class or member method has an abstraction attribute

Assert is used for program debugging

Boolean Boolean type

Break jumps out of a block early

byte byte type

A branch of a case switch statement

Catch is used in exception handling to catch exceptions

char character type

Class

Continue back to the beginning of a block

CONST reserved keyword, no specific meaning

Default defaults, for example, in a switch statement, indicating a default branch

Do in the DO-WHILE loop structure

Double dual-precision floating-point number type

else used in a conditional statement to indicate a branch when the condition is not established

Extends indicates that one type is a subtype of another type, where the common types have classes and interfaces

Enum enum

Final is used to describe the final attribute, indicating that a class cannot derive a subclass, or that a member method cannot be overwritten, or that the value of a member field cannot be changed

Finally, which is used to handle exception cases, to declare a block of statements that are essentially going to be executed

Float single-precision floating-point number type

For a guide word for a looping structure

GOTO reserved keyword, no specific meaning

The guide word of the IF condition statement

Implements indicates a class that implements a given interface

Import indicates that you want to access the specified class or package

Instanceof used to test whether an object is an instance object of a specified type

int integer type

Interface interface

Long integer type

Native is used to declare that a method is implemented by a computer-related language.

New to create an instance object

Package Packages

Private access Control method: Private mode

Protected an Access control method: Protection mode

Public an access control method: Common mode

Return the data from the member method

Short integer type

Static property is indicated by

Synchronized indicates that a piece of code needs to be executed synchronously

Super indicates the reference to the parent type of the current object or the constructor of the parent type

STRICTFP used to declare fp-strict (single-precision or double-precision floating-point number) expressions following the IEEE 754 arithmetic specification

This refers to a reference to the current instance object

Throw throws an exception

Throws declares all exceptions that need to be thrown in the currently defined member method

Transient declaring a member domain without serialization

Try a block that might throw an exception

Void indicates that the current member method has no return value

Volatile indicates that two or more variables must vary synchronously

While is used in the loop structure

Variable

A variable has four basic properties: variable name, data type, storage unit, variable value

To define the format of a variable:

Type variable name or list of variable names with initialization;

such as: int A;

Computer storage Unit

Java Basic syntax

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.