[Java4android] Variables for Java

Source: Internet
Author: User

video from:http://www.marschen.com/

1. What is a variable

2. Declaration of variables

3. What types are variables divided into?

What is a variable?

1. The computer is an extremely accurate machine;

2. To store information in a computer, you must indicate the location of the information store and the storage space required;

3. In Java into language, use the LIFE statement to accomplish the above tasks;

Declaring methods for variables

int age;

Variable type variable name means statement end

This statement allows the computer to allocate enough space to store an integer whose name is called Age. int is a Java-defined data type that is dedicated to storing integers of a certain size;

What types of variables are used?

Basic data type:

Integer type: Int (byte, short, int, long)

Floating-point type (float,double)

Character type: (char)

Boolean type: (Boolean)

Reference data type:

Classes (Class)

Interface (interface)

Array

Naming conventions for variables

1. Variable naming syntax specification

1. Should be preceded by a letter underline or dollar sign;

2. The following letter underlines the dollar symbol or number;

3.java variable name has no length limit;

4.java variable name is case sensitive

2. Camel naming law:

1. Variable names should use meaningful English words;

2. Variable name if there is only one word, all the letters are lowercase;

3. If a variable name consists of multiple English words, the first letter is capitalized from the second word;

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.