The basic grammar of the second play of Java Foundation

Source: Internet
Author: User

Java keywords

Abstract: Indicates that a method in a class or class is abstract;
Boolean: One of the basic data types, Boolean type;
break: Jump out of a block in advance;
byte: One of the basic data types, byte type;
case: In the switch statement, one of the branches is indicated;
catch: Used to handle exceptions, to catch exceptions;
Char: One of the basic data types, character type;
class: Class;
continue: Back to the beginning of a block;
default: Used in a switch statement to indicate a default branch;
do: Used in the "Do While" loop structure;
Double: One of the basic data types, double-precision floating-point number types;
else: In the conditional statement, indicates the branch when the condition is not established;
extends: Used to indicate that a class is a subclass of another class;
final: Used to indicate that a class cannot derive a subclass, or that a method in a class cannot be overridden, or that a variable is a constant;
finally: used to handle exception cases, to declare a block that is bound to be executed;

float: One of the basic data types, single-precision floating-point number type;
for: A guide word of cyclic structure;
if: The guide word of the conditional statement;
implements: Indicates that a class implements a given interface;
import: Indicates to access the specified class or package;
instanceof: Used to test whether an object is an instance of a specified class;
Int: One of the basic data types, integer type;
interface: interface;
Long: One of the basic data types, long integer type;
native: Used to declare a method that is implemented by a machine-related language (such as the C/c++/fortran language);
NEW: Used to apply for new objects;
Package: Package;
private: A type of access: private mode;
protected: A way of access: protection mode;
public: A Way of access: public mode;
return: Returns the value from the method;
Short: One of the basic data types, the short integer type;
static: Indicates that the domain or method is static, that is, the domain or method belongs to a class;
STRICTFP: Used to declare fp-strict (double or single-precision floating-point number) expressions, see IEEE 754 arithmetic specification;
Super: A reference to the parent class object of the current object;
switch: The guide word of the branching structure;
synchronized: Indicates that the execution of a piece of code needs to be synchronized;
this: a reference to the current object;
Throw: Throws an exception;
throws: Declares all exceptions thrown in the method;
transient: Declares a domain without serialization;
Try: Try a block that might throw an exception
void: Indicates that the method does not return a value;
volatile: Indicates that two or more variables have to be changed synchronously;
while: used in the cyclic structure;
assert: declaring assertions;
enum: declaring enum type;

Note:Goto and const are not keywords used in the Java programming language, but are reserved words for Java, meaning that Java retains them, but does not use them. True and false are not keywords, but Boolean type direct quantities

Java Data types

Basic data types in Java

Java consists of 8 basic data types, which can be divided into four categories

(1): Integer type: Byte, short, int, long


(2): Float type: float, double


(3): Character type: Char


(4): Logical Type: Boolean

Attention:

1. Integer values are signed numbers

2. Floating-point value, if not specified, the default is double type

3. When defining float type, be sure to indicate float type, which can be expressed by adding "F" or "F" after the number.

4. Char represents a 16-bit unsigned (non-positive) Unicode character, and a char character must be enclosed in single quotation marks.

5. There is no conversion calculation between the integer type and the Boolean type. You cannot convert integer types and logical types directly in Java

string-type String

Attention:
(1): String is not the original data type, but a class
(2): String contains any number of characters, and the character type can only be one. It is important to note that "a" represents a string, whereas ' a ' represents a character type, and they have different functions.
(3): The default value of String is null

The basic grammar of the second play of Java Foundation

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.