Java Program Ape Data operations and operators

Source: Internet
Author: User
Tags java keywords

Java is a strongly typed language, and the strongly typed language contains two meanings: 1, all variables must be declared first, and then used; 2, variables of the specified type can only accept values that match the type.

The basic types are broadly divided into two types: numeric and Boolean, where numeric types include: shaping, character, floating-point. All numeric types can be type-cast directly, including automatic type conversions and forced type conversions.

Spaces in the Java language include space, tabs (tab), and carriage returns (enter), and so on.

Identifier rules: Identifiers are symbols that are used to name variables, classes, and methods in a program. The Java language identifier must begin with a letter, underscore (_), Dollar ($), followed by any number of letters, numbers, underscores, and dollar characters.

The use of identifiers should be noted that: 1, identifiers can be composed of letters, numbers, underscores, dollar characters, where the number can not begin; 2, identifiers cannot be Java keywords and reserved words, but can contain keywords and reserved words; 3, identifiers cannot contain spaces; 4, identifiers can contain only dollar characters, cannot contain @, # and other special characters.

Java keywords: Some special-purpose words in the Java language are referred to as keywords, and when defining identifiers, do not let identifiers and keywords be the same, or it will cause an error.

All Java keywords are lowercase.

The essence of programming is the orientation and modification of the data in memory, the data used by the program is stored in memory, and the programmer needs a mechanism to access or modify the in-memory data. This mechanism is a variable, each variable represents a small block of memory, and the variable is a name, the program assigns a value to the variable, in fact, the data is loaded into the memory area represented by this variable, the program reads the value of the variable, is actually the process of taking the value from the memory area represented by the variable. A variable is the equivalent of a container with a name that is used for various types of data.

Define a variable to specify an initial value, or you may not know the initial value. Define variables to specify at least two parts of the variable type and variable name.

The types supported by the Java language are divided into two categories: the base type and the reference type.

The base types include numeric types and Boolean types, and numeric types include integer types and floating-point types. Integer types include byte, short, int, long, char, floating-point types including float and double.

Char is a character type, and character type is a special type of integer.

Reference types include classes, interfaces, and array types, and a special type of NULL. The so-called reference data type is a reference to an object, including instances and arrays of two objects. A null reference (NULL) can be converted to any reference type.

Basic data types: integer type, one byte, byte, 8 bits, range 128 to 127,short 16 bits, int 32 bits, long is 64 bits.

int is the most commonly used integer type and, in general, gives an integer value directly to the int type by default.

If you assign a small integer value (within the range of a byte or short type) directly to a byte or short variable, the system automatically treats the integer as a byte or short type.

If you use a huge integer value (over the range of int tables), Java does not automatically treat this integer value as a long type, and if you want the system to treat an integer value as long, add either L or L as a suffix after the integer values.

Character types are typically used to represent a single character, character types must be enclosed in single quotes, and Java uses a 16-bit Unicode character set as the encoding method.

Java Program Ape Data operations and operators

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.