variables, member variables, local variables such as Java easy to confuse concepts

Source: Internet
Author: User

variables, member variables, local variables such as Java easy to confuse concepts

class variables, member variables, local variables

decoration. ( static = " global " , " static " , used to modify member variables and member methods, or static blocks of code (static code blocks are independent of class members, JVM

Member variables (also called " instance variables "," domains ") are also variables that are independent of the method in the class, but no Static decoration.

A local variable is a variable in a method of a class.

Look at the following pseudo-code description:

public class variable{

static int allclicks=0;// class variable

String str= "Hello World";// instance variable

public void Method () {

int i =0;// local variables

}

}

Member variables are also known as :" domain "," instance variable ", which is called in an entity class or data class. Properties or fields . When a member variable can be changed, it is called the state of the object.

Constants: final decoration, values cannot be modified once given

variables, member variables, local variables such as Java easy to confuse concepts

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.