"Java" java_05 identifiers and character sets

Source: Internet
Author: User
Tags uppercase letter

1. Identifiers

Used to name variables, classes, and methods. Attention:

  The identifier that represents the class name begins with an uppercase letter. such as:man, GoodMan

  the identifiers that represent methods and variables begin with lowercase letters, and the following descriptive words begin with uppercase. Green(),greencard ()

The Java identifiers have the following naming conventions:

<1> identifiers must begin with a letter, underscore _ , dollar symbol $

<2> The other part of the identifier can be a letter, an underscore "_", a dollar symbol "$" , and any combination of numbers

<3> Java identifiers are case sensitive and have unlimited length

<4> it can't be . keywords for Java

Valid identifiers:

int a = 3;

int _123 = 3;

int $12AA = 3;

int variable 1 = 55;

An illegal identifier:

int 1a = 3; Cannot start with a number

int a# = 3; Cannot contain special characters such as #

int int = 3; Cannot use keywords

JAVA does not use the ASCII character set used in the usual language , but rather a Standard international character set such as Unicode.

2. Character Set

Keywords / reserved words in 3.JAVA

The Java keyword is reserved for internal use by the Java language , such as class for defining classes. Keywords can also be called reserved words , they mean the same

Abstract

Assert

Boolean

Break

Byte

Case

Catch

char (character)

Class

Const

Continue

Default

Do

Double

Else

Extends

Final

Finally

Float

For

Goto

If

Implements

Import

instanceof

Int

Interface

Long

Native

New

Null

Package

Private

Protected

Public

Return

Short

Static

Strictfp

Super

Switch

Synchronized

This

Throw

Throws

Transient

Try

void

Volatile

While

Note: You cannot use a keyword as a variable name or a method name

 

"Java" java_05 identifiers and character sets

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.