Java Basics Essay

Source: Internet
Author: User

1. Identifiers: All components of Java require a name. Class names, variable names, and method names are called identifiers.

For the Java identifiers, there are a few things to note:

      • All identifiers should start with a letter (A-Z or a-Z), a dollar symbol ($), or an underscore (_).
      • Can be a combination of any character after the first character
      • Keyword cannot be used as an identifier
      • Identifiers are case-sensitive
      • Examples of legal identifiers: Age, $salary, _value, __1_value
      • Examples of illegal identifiers: 123abc,-salary String (keyword) Java modifier

Like other languages, Java can use modifiers to decorate methods and properties in a class. There are two main types of modifiers:

    • Access control modifiers: default, public, protected, private
    • Non-access control modifiers: final, abstract, STRICTFP
    • Java keywords

      The following is a list of Java reserved words. These reserved words cannot be used for constants, variables, and names of any identifiers.

      Key Words Description
      Abstract Abstract methods, modifiers for abstract classes
      Assert Whether the assertion condition satisfies
      Boolean Boolean Data types
      Break Jump out of a loop or label code snippet
      Byte 8-bit Signed data types
      Case A condition for a switch statement
      Catch Match with try and catch exception information
      Char 16-bit Unicode character data type
      Class Defining classes
      Const Not used
      Continue Do not execute the remainder of the loop body
      Default Default branch in the switch statement
      Do Loop statement, the loop body is executed at least once
      Double 64-bit double-precision floating-point number
      Else The branch that executes when the IF condition is not established
      Enum Enum type
      Extends Represents a class that is a subclass of another class
      Final Indicates that a value cannot be changed after initialization
      Indicates that a method cannot be overridden, or that a class cannot have subclasses
      Finally In order to complete the execution of the code design, mainly for the robustness and integrity of the program, regardless of whether there is no exception to execute code.
      Float 32-bit single-precision floating-point number
      For For Loop statement
      Goto Not used
      If Conditional statements
      Implements Indicates that a class implements an interface
      Import Import class
      instanceof To test whether an object is an instance of a class
      Int 32-bit integer number
      Interface interface, an abstract type, with only the definition of methods and constants
      Long 64-bit integer number
      Native Represents methods implemented in non-Java code
      New Assigning a new class instance
      Package A series of related classes make up a package
      Private Represents a private field, or method, etc., accessible only from within the class
      Protected Indicates that a field can only be accessed through a class or its subclasses
      Subclasses or other classes within the same package
      Public Represents a shared property or method
      Return Method return value
      Short 16-digit number
      Static Represents a class-level definition that is shared by all instances of the
      Strictfp Floating-point comparisons use strict rules
      Super Represents a base class
      Switch SELECT statement
      Synchronized A block of code that represents a single thread that can be accessed at the same time
      This Represents the invocation of the current instance
      or call another constructor
      Throw Throw exception
      Throws Defining exceptions that a method might throw
      Transient Modify fields that do not serialize
      Try Represents a code block to do exception handling or a finally mate to indicate whether throwing an exception executes the code in the finally
      void Tag method does not return any values
      Volatile Tag fields may be accessed by multiple threads at the same time without synchronizing
      While While loop

Java Basics Essay

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.