Variables for the Java Foundation

Source: Internet
Author: User

What is a variable? variables are used to refer to a piece of storage area in memory , must have a specific data type, different data types represent different data storage structures, and data types determine the size of the memory area to put what data

 Public classDemoone { Public Static voidMain (string[] args) {intA, B, C;//declare three variables at a timeA = 5; b= 6; C= 7; System.out.println ("A=" + A + "\tb=" + B + "\tc=" +c); intD = 1, E = 2;//declare and initialize at the same time        intf = 3; System.out.println ("D=" + D + "\te=" + E + "\tf=" +f); intX=a;//Copy the value in memory of the A identity and assign it to the memory identified by XSystem.out.println (x); }}

variable names must begin with a letter, $, or _, followed by numbers, letters, _, and $, not Java keywords and reserved words

A variable must be declared and assigned before it can be used --variable declaration must have a type, the assignment must be of type matching--the variable in the same scope can be repeatedly assigned, but the consent scope cannot be defined repeatedly

Variables for the Java Foundation

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.