Learn Java Keywords

Source: Internet
Author: User

Background

Because in Ali's internship interview was asked in Java what keywords this problem, but I feel very basic but has not much attention to the knowledge point, perhaps the interviewer is not to you can really remember the Java 50 keywords, but the answer to the idea, did not want to understand, only said some basic data types, Now make a good summary.

Categorical data type (8) Word
Key Words typelength Notes
Boolean Boolean type 1byte True,false
Byte BYTE type 1byte -128~127
Char Character type 2byte Unicode code
Short Short-integer 2byte
Int Integral type 4byte
Long Long integer type 8byte
Float Floating point Type 4byte
Double Double-precision Type 8byte
Classes, interfaces, methods, and variable modifiers (13)
Key Words function Notes
Class Represents a class Define a class
Interface Represents an interface Define an interface
New Assigning a new class instance Attention differs from malloc
Abstract Abstract methods, modifiers for abstract classes
Extends Represents inheritance
Implements Represents the implementation interface
Final Modifier class, method, variable
Native Represents methods implemented in non-Java code
Static Represents a class-level definition that is shared by all instances of the
Strictfp Can be applied to a class, interface, or method strict float point (exact float) All floating-point operations are accurate within the scope declared by this keyword
Synchronized For methods or blocks of code Multi-threaded synchronization
Volatile Tag fields may be accessed by multiple threads at the same time without synchronizing
Transient Modifies a field that does not serialize in a class that implements a serializable interface
Process Control (11)

If: Indicates conditional judgment, general usage if (relational expression), followed by else or {...}

Do......while ... : Do and while are typically used together to represent loop statements.

For: Used to represent loops, for loops are the most commonly used loops

switch (condition a) case ... : switch and case are combined to represent the conditional branching process. Default is used when all case conditions are not true. If used for a class, it means that only other classes within the same package can be accessed.

Break: Used to end this layer loop or jump out of a layer loop.

Continue: Used to jump out of this loop, and break jumps out of this layer loop.

Return: Returns a value, typically used in a function, that returns a value of a specific type.

Access Control (3)
Key Words This class Same Package different packet neutron class different packages and no inheritance effect (meaning)
Public OK OK OK OK Public-owned
Protect OK OK OK No The protected
Default (no permission modifier) OK OK No No The default
Private can OK No No No Privately owned
Error handling (5)

Try......catch......finally ... : For exception handling

Throw throws an exception object

Throws declares an exception that may be thrown

Package related (22)

Import Introduction

Package Packages

Variable references (3)
    1. Super Parent class, Super class
    2. This class
    3. void no return value
Reserved words (2)

Goto Jump
Const static

Other key words

Instanceof determine if an object is the object you want
Assert asserts whether the condition satisfies
enum Enum type

Learn Java Keywords

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.