Web-android Engineer first-2-4 variables

Source: Internet
Author: User

Source: http://www.imooc.com/code/1183

Simply put, we can think of variables as a box that can store items such as keys, cell phones, and drinks in this box, or we can replace them with new items that we want to store when we need them.

In Java, we describe variables by three elements: variable type, variable name , and variable value .

If we compare a variable to a hotel room, the data to be stored is like the guest who wants to stay, we can arrange it according to Guest's request to stay "standard room" or "Presidential Suite", and can quickly find the guest's information according to the room name. In the same vein, in a Java program, we can also save it in a variable space of the specified type according to the format of the data we need to save, and quickly locate it with the variable name!

For example, we define a variable love, which is used to hold a string "Imooc", and in the program we can find the "IMOOC" stored in it just by finding the variable of love! Of course, we can also change the value of love into a new string "I love Imooc"!

Operation Result:

Task

Self-test time is up!

In the editor, enter the code for the 3rd line to define a variable hobby, save the "Mu net" this string

Operation Result:

 Public class HelloWorld {    publicstaticvoid  main (string[] args) {        = "mu class net" ;        SYSTEM.OUT.PRINTLN (hobby);    }}

Web-android Engineer first-2-4 variables

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.