Mobile development Four languages Overview two: Identifiers

Source: Internet
Author: User
Tags exception handling goto lowercase modifier reserved volatile java keywords

Defined:

An identifier is a constant, a variable, a statement label, and the name of a user-defined function, as well as a later interface name, class name.

The C language stipulates that identifiers can only consist of letters, numbers, underscores, and can only begin with letters, underscores, and cannot be used as identifiers by keywords.

C + + is the same as the C language for identifiers.

Objective-c also ditto.

Java can use the $ symbol at the beginning and anywhere, with the rest above.

Conventions for Java identifiers:

1. Classes and interfaces usually use nouns and capitalize the first letter of each word.

2, the method name usually uses the verb, the first letter lowercase.

3, the constant is usually all uppercase, the words are separated by the underline.

4, the variable usually uses verbs, the first letter lowercase.

C # variables can be in the form of the "@" + keyword, with the rest in the C language.

For example: Char @new

second, the key words

Some identifiers that are assigned to a particular meaning are called keywords (or reserved words).

C's Keywords:

A total of 32 reserved words are defined by the ANSI standard:

1, program Control 12:

If,while, Break,else,switch,case,return,continue,goto,default,do,for

2, Data type 12:

Double,int,struct, Long,enum,char,float,short,union,unsigned,signed,void

3, Storage Category 4:

Auto, register, extern, static

4, the other 4:

Typedef,const,sizeof,volatile

C + + keywords:

A total of 74 keywords, fully inherited from the C language of the 32. The remaining 42 are as follows:

1, operator 11:

And, And_eq, Bitand, Bitor, compl, not, not_eq, or, Or_eq, XOR, Xor_eq

2, the other 15:

ASM, Delete,explicit,export,friend,inline,mutable,namespace,new,operator,this,typeid,typename,

Using,virtual,

3, data type 6:

bool,class,false,template,true,wchar_t,

4, type conversion 4:

Const_cast,dynamic_cast,reinterpret_cast,static_cast

5, Access rights control 3:

Private,protected,public

6, exception handling 3:

Try,catch,throw

objective-c Keyword:

A total of 58 keywords, fully inherited the C language keyword. The rest is as follows:

1, special predefined identifiers 15:

_cmd,__func__,bool,class,id,imp,nil,nil,no,nsobject,protocol,sel,self,super,yes

2, the other 11:

Restrict,out,oneway,inout,inline,in,byref,bycopy,_imaginary,_complex,_bool

java Keywords:

Java a total of 47 keywords.

The C language of 32 keywords Java inherits only 21, and does not inherit the following:

Goto, struct, union, signed, unsigned, auto, register, extern, typedef, const, sizeof

Your own 26 keywords are as follows:

1, Data type 5:

Boolean, Byte, class, interface, package

2, exception handling 5:

Try,catch,throw, throws, finally

3, Access rights control 3:

Private,protected,public

4, the other 13:

Abstract, extends, final, implements, import, instanceof, native, new, super, synchronized, this, transient, strictfp

C # Keywords:

C # A total of 79 keywords (2012 edition).

Abstract

As

Base

bool

Break

Byte

Case

Catch

Char

Checked

Class

Const

Continue

Decimal

Default

delegate-Delegation

Todo

Double

Else

Enum

Event

Explicit

extern

False

Finally

Fixed

Float

For

Foreach

Goto

If

Implicit

In

In (generic modifier)

Int

Interface

Internal

For

Lock

Long

Namespace

New

Null

Object

operator

Out

Out (generic modifier)

Override

Params

Private

Protected

Public

ReadOnly

Ref

Return

SByte

Sealed

Short

sizeof

Stackalloc

Static

String

struct

Switch

This

Throw

True

Try

typeof

UInt

ULong

Unchecked

Unsafe

UShort

Using

Virtual

void

Volatile

While


With the knowledge of these keywords, there is no error in naming identifiers yourself. More importantly, the identifiers from each language can also pry out some of the inner details of the language.

In the process of summing up these knowledge also let me learn a lot, language is the basis of all, lay the foundation in the programming practice will not be lost.

About the grammatical knowledge of the language, let me slowly.

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.