stay Java There are no global variables in the language   The simplest way to analyze the scope of various variables is to use curly braces as the boundary ,

1. Member variables are defined in the class body , Member variables are initialized by default

2. Local variables are defined in methods , Local variables are not initialized by default

Java More articles on local variables and member variables of

  1. JAVA Central variable and What are the differences between member variables

    JAVA Central variable and What are the differences between member variables 1. The definition is not the same < a key >*** local variable : In the method's internal member variable : Outside the method , Write directly in the class 2. The range of action is different < a key >*** Local ...

  2. java Local variables and member variables and the difference between them

    One . local variable Variables that exist in a method are called local variables , Once a local variable is declared, it must be assigned a value Otherwise you can't use it The code is as follows : class Person { String name; char sex; int age; pu ...

  3. 《java The difference between the local variable and the member variable 》

    class Car { String color; int number; void run() { System.out.println(color+"::"+number); ...

  4. java The main difference between local variables and member variables is their scope

    The first member variable is inside the class : A local variable is inside the method body that defines it ( Or in a block within the method body —— Curly braces , It mainly depends on the location of the definition ). in addition , Member variables may not be explicitly initialized , They can be set by default by the system : Local variables have no default value , So you have to set ...

  5. java The basic study summarizes three (jdk7 New characteristics 、 Variable ( Local variables and member variables )、 Constants and operators )

    One :jdk7 New characteristics Can represent binary values , With 0b start , You can use an underline in the middle _ Separator . as follows : @Test /** * test jdk New characteristics */ public void testJdk7(){ int a=0b ...

  6. java class (Class) The concept of ; The concept of object , Declare the properties of the class And methods , Local variables and member variables , Object-oriented programming thinking , Abstract concept

    class (Class) The concept of A class is an abstract description of a group of objects with the same characteristics and behaviors . understand : [1]  Class contains two elements : Characteristics and behaviors  => The same kind of things have the same characteristics and behaviors . [2]  Class is a group concept . for example : network ...

  7. Java Object oriented local variables and member variables

    package cn.itcast.day06.demo03; /* Local variables and member variables 1. The definition is not the same [ a key ] local variable : Inside the method , Class Member variables : Outside the method , Write directly in the class ...

  8. If java A member variable in a class is its own object

    If java A member variable in a class is its own object , How to allocate space in memory when creating a new object of this type , I feel like a dead cycle .  But I think it must be wrong , Because many class member variables are their own objects , And absolutely right , for instance : Class A{ pr ...

  9. C# Process oriented local variables 、 Member variables 、 Variable scope 、 Variable parameters

    Local variables and member variables :   local variable : Variables defined in methods are called local variables : There is no default initial value , You must assign a member variable to a variable before you use it : Variables defined under a class are called member variables : If it is a numeric type, the default initial value is 0 If it's a reference type ...

Random recommendation

  1. oracle transfer mysql Database note

    oracle turn mysql modify : . substr() substr( string , 0, 10) Test here Must be from The first to get both substr(string , 1 , 10)2. to_ch ...

  2. Problem solving ——WSAAsyncSelect Model Don't trigger FD_CLOSE

    ================================== Statement ================================== This article is original. , Reprinted in the text of the prominent note and the source of the author , And ensure the end of the article ...

  3. informix Export table structure under database

    1) Export all the table structures in the database to a file db.sql  $>dbschema -d your_database -t all  db.sql 2) Export all stored procedures in the database to a file db.sql  $&g ...

  4. UISegmentedControl UISlider

    self.view.backgroundColor = [UIColor whiteColor]; //UISegmentedControl yes iOS Segment control in , In fact, it's multiple button Combined view of , ...

  5. php To configure xdebug

    https://blog.csdn.net/Alan8865/article/details/81331252

  6. C# relevant FTP operation

    C# relevant FTP(File Transfer Protocol) operation 1. Get file directory UsePassive: I need to set to false. Use passive mode , Because of the existence of client firewall , So in order to make sure that the data is normal ...

  7. Python Read PE file (exe/dll) Timestamp in

    Code original address : https://www.snip2code.com/Snippet/144008/Read-the-PE-Timestamp-from-a-Windows-Exe https://gi ...

  8. linux Network operating Firewall related operations

    Firewall status Query firewall status service iptables status Stop firewall service iptables stop Start the firewall service iptables start service iptables restart ...

  9. Use html+css+js Realize the pinball game

    Use html+css+js Realize the pinball game design sketch : The code is as follows , Copy and use : <!doctype html> <head> <style type="text/c ...

  10. Discussion on written examination questions java Basics

    Java Base part The order of the basic parts : Basic grammar , Class related Syntax , Syntax of inner class , Inheritance related Syntax , Unusual grammar , The syntax of threads , The grammar of sets ,io The grammar of , Syntax for virtual machines , other . Some of the questions are collected from the Internet , Some of the questions come from wisdom ...