Variables for the Java Foundation

Source: Internet
Author: User

Original link: http://www.verejava.com/?id=1699255231918

/* Note: 1. Variable naming does not allow repetition of 2.    Naming rules for variables: a character, an underscore, a $, a number, and the beginning of the first letter must be a character, a slide line, or $ cannot be a number */public class testvariable{public static void Main (string[] args)        {//Variable definition: A system-allocated chunk of memory used to store data in a//string type string: A character or kanji enclosed in double quotes ""//bottle        Variable name//equals = Delegate assignment that means "mineral water" data is stored in a memory area named bottle. String bottle= "Mineral water";        Print output of the variable named Bottle Memory area to the console System.out.println (bottle);        Modify the value of the variable to replace "juice" with the value of the bottle memory area bottle= "Juice";        SYSTEM.OUT.PRINTLN (bottle);        Empties the variable, emptying the bottle memory data bottle= "";        SYSTEM.OUT.PRINTLN (bottle);        Delete variable, assign value to null value delete variable, this time garbage collector GC if scan to//bottle variable will automatically reclaim allocated memory space bottle=null;        SYSTEM.OUT.PRINTLN (bottle);        Note://1. Variable names cannot be defined repeatedly, otherwise compilation cannot be bottle= "milk" through//string;        SYSTEM.OUT.PRINTLN (bottle);        The naming rules for variables: a character, an underscore, a $, a number, and the beginning of the first letter must be a character, the slide line or the $ cannot be a number//string 1a= "a";        SYSTEM.OUT.PRINTLN (1a);        String $b = "B";System.out.println ($b);        String _c= "C";    System.out.println (_c); }}

Original link: http://www.verejava.com/?id=1699255231918

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.