java--Basic Syntax

Source: Internet
Author: User

Grammar Description
Comments
// Single-line Comment
/*...*/ Multi-line comments
/**...*/ Document comments
Separator
; Each Java statement must end with A;
{} Define a block of code
[] Used to access array elements 0-n
() Method definition, method invocation, operator
. Delimiter between a class/object and its members
Identifier
Consists of letters, underscores (_), dollar characters ($), numbers, where numbers do not begin
Java keywords
Abstract Abstract
Assert
Boolean Boolean (can only be true or FALSE, other data types cannot be converted to Boolean types)
Break End Loop, etc.
Byte Integral type (1 bytes)
Case Branch statements
Catch
Char Character type (2) "
Class Class
Const Reserved words
Continue End this cycle
Default Default (interface default class definition)
Do Looping statements
Double Floating-point (8)
Else Judgment statement
Enum Enumeration
Extends A successor B (class A extends B)
Final
Finally
Float Floating-point (4) is defined with a number followed by F to indicate
For Looping statements
If Judgment statement
Goto Reserved words
Implements Implementing interfaces
Import Classes for importing Packages
instanceof (operator) to determine if the conversion can be successful
Int Integral type (4)
Interface Defining interfaces
Long Integer (8) is defined by the number followed by the L to indicate
Native Similar to an abstract approach, the difference is that the native method is usually implemented in C (will lose cross-platform functionality)
New Call constructor
Package Create package (first line)
Private Private
Protected
Public Total
Return End method
Short Integral type (2)
Static Static (class member)
Strictfp Make floating-point calculations more precise within the cosmetic range
Super Call the parent class overridden instance method | variable
Switch Branch statements
Synchronized
This Invokes the member of the current class (non-static adornment)
Throw
Throws
Transient
Try
void No return value
Volatile
While Looping statements
Automatic type conversion
BYTE---------long------double
CHAR-to-int
Forcing type conversions
(targetType) value Force the conversion of value to the TargetType type
Expression type auto-promotion
All byte, short, char type will be promoted to int type
The entire arithmetic expression data type is automatically promoted to the same type as the highest-level operand in the expression
Two integers, even if not done, will get an integral type
Trinocular operator
(expression)? If-true-statement:if-false-statement

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.