Java identifier + name specification + data type

tags: Identifier  Name specification  type of data

Identifier

  • Some names that are customized in the program.

  • Composed of 26 English letters, number: 0-9 Symbol: _ $

  • Define legal identifier rules:1. The number cannot be started.

2. No keywords can be used.

  • Java is strictly case sensitive.
  • Note: When making a name, try to make sense as much as possible to improve your reading.

2. Name specification

Name specification in Java:

  • Package Name: All letters are lowercase when composed of multiple words.

       • xxxyyyzzz

  • Class name interface name: When multiple words are composed, the first letter of all words is capitalized.

       • XxxYyyZzz

  • Variable name and function name: When multiple words are composed, the first word is lowercase and the second word begins with the first letter of each word.

       • xxxYyyZzz

  • Constant name: All letters are capitalized. Each word is connected with an underscore when multiple words are used.
    • XXX_YYY_ZZZ

3. Data type

type of data

Among them, the basic data type size is as follows:

Integer type: (The bold part below is the wrapper class for each data type)
byte (1 byte) (Byte), short (2 bytes) (Short), int (4 bytes) (Integer), long (8 bytes) (Long)
Floating point type:
float(4 bytes)(Float), double(8 bytes)(Double)
Logical:
boolean(true/false)(Boolean)
Character:
char (2 bytes) (Character)

Byte: A byte type integer occupies 8 bits in memory. The range of the table number is -128(-2^7)~127(2^7-1)
short: A short type integer takes up 16 bits in memory, and the table number ranges from -32768(-2^15)~32767(2^15-1)
int: An integer of type int occupies 32 bits in memory, and the range of the table number is -2147483648(-2^31)~2147483647(2^31-1)
long: A long type integer takes 64 bits in memory, and the table number ranges: (-2^63)~(2 ^63-1)

Note: long l = 4l;

       float f = 2.3f; 

The range of the basic data type is byte->short->int->long->float->double (range from small to large)

Basic data type interview questions:

[java interview questions] Basic data types and other issues:

 

Intelligent Recommendation

Detail java identifier and data type

Some basic concepts of identifiers The identifier is the name used in programming: Java's sequence of characters used for naming packages, classes, interfaces, methods, variables, constants (excluding...

[Java basic] data type and identifier

~ New Java article appeared, this content book is aboveJava first program。 Let's talk about the most basic content in Java -type of dataversusIdentifier type of data As a high-level programming langua...

Java annotation, identifier, data type

Comment Multi-line comments / * Note * / Untrue note // Note Text Notes / ** * / Identifier Keyword All parties of Java need name. Class names, variable names, and method names are called identifiers....

Java identifier, data type, operator

Java identifier All identifiers can only start with letters (case), $, _, start type of data Java is a strong type language: All variables must be defined before they can be used Floating point expans...

Java identifier, data type and expression

Java identifier, data type and expression Article catalog Java identifier, data type and expression First, identifier and data type 1.1 Java basic syntax unit 1.1.1 Notes 2.1.3 Keywords 2.1.4 identifi...

More Recommendation

Java — DAY02 identifier, data type

1 java grammar basics 1.1 identifier The identifier can be simply understood as a name. In Java, we need to identify many elements of the code, including class names, methods, fields, variables, packa...

Software writing specification (identifier name)

// Excerpt from Huawei to write specifications 1, the naming of the identifier is clear, clear, clear meaning, and use a complete word or abbreviation, you can basically understand, avoid misunderstan...

Identifier rule name specification variable

Identifier rule Java strictly sized Alphanumeric _ $ composition Number can't start Identifier cannot contain spaces Name specification Package: xxyyzzz Class name: xxyyzzz Variable name method name: ...

Java identifier, keyword, data type, reference type

Identifiers and keywords The identifier in Java refers to the name, class name, and attribute name. Requirements: The indicator consists of letters, numbers, _, $, ¥, which cannot be started with ...

Java identifier naming specification

Foreword The complexity of modern software architecture needs to be collaborative development, how can I collaborate efficiently? There is no rules that are not square, and there is no standard. For e...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top