hypothesis , You're interviewing , The interviewer asked you , Would you please give us a brief introduction of your right static Understanding of key words ?

   it's me , I might just say ,static
Is used to modify static constants , It can also modify methods , Others, if we haven't prepared them in advance , I don't think I can say much , The longer you work , The more I feel , I seem to know this thing , May also use , But if someone asks you , You can't say you're ugly , Don't deny , That's what most of us programmers do , Me too. , of course “ Okami ” except .

   To solve this problem , Answer given , It can be roughly divided into the following levels .

   1. answer ,static Is used to modify variables , Modified method , The interviewer will think you are qualified , Of course, it's just passing .

   2. answer ,static Decorated code block , Static block correlation , The interviewer will think you're good .

   3. answer ,static Static inner class , relevant , The interviewer will ask you well .

   4. answer ,static Static guide package correlation , The interviewer will be satisfied with you .

  Don't look down , Some basic questions , Although they are all very good , But it's not necessarily a good answer .

That's all , Let's talk about it in detail ,static Relevant knowledge points of .

Basic concepts

    1.static
Decorated object , method , variable , Convenient to call without creating objects . in other words , cover static After retouching , No need to create objects , It can also be called directly through the class name .

   2.java inside static Commonly used to decorate member variables or functions . But there's a special way to use it static Modify inner class , Normal classes are not allowed to be declared static , Only inside   Only by category .

 3. cover static Decorated member variables are called static variables , Also called class variable , Indicates that this variable belongs to this class , Not belong to the object .

 4.static Keywords can be used to decorate code blocks .

In depth understanding

  To learn more static The deep principle of key words , From JVM The memory of , In this respect, I am also learning , I don't understand very well , Let's not go over it , Interested can be studied in depth , Research .

static Summary of the characteristics of

1,static It's a modifier , Used to decorate members .( Member variable , Member function )static Decorated member variable Called static variable or class variable .

2,static Decorated members are shared by all objects .

3,static Priority over object existence , because static As the class is loaded, the members of .

4,static Decorated members have one more way of calling , Can be called directly by class name ,( Class name . Static member ).

5,static Decorated data is shared data , Objects store unique data .

ok, About static Keyword's , So much understanding , Thank you for browsing , If you have any questions, please leave a message for correction , Studying hard .

 

 

 

Technology
©2019-2020 Toolsou All rights reserved,
JAVA Detailed explanation of anomalies MySQL An interview is a must ! How to use it quickly html and css Write static page R Language cluster analysis case Dialogue between apple and Nissan suspended ,Apple Car How's it going ?java Realize the function of grabbing red packets SpringBoot practice ( five ):mybatis-plus In BaseMapper,Iservice and ServiceImpl Google says home office affects work efficiency !2021 Return to offline office in 2010 about keras use fit_generator Encountered in StopIteration Programmer Tanabata Valentine's Day confession code