the inner class is actually a class that also contains another classAs a person is composed of body results, such as the brain, limbs, organs, and the inner class is equivalent to one of the organs, such as the heart: it also has its own properties and behavior (blood, beating) obviously, here can not unilaterally use properties or methods to express a heart, but
toInner Inner = new Inner ();Inner.inner_f2 ();}public static void Main (string[] args) {New Outer (). OUTER_F3 ();}}Generating a static inner class does not require an external class member: This is the difference between a static inner class and a member inner class. Objects of the static inner
toInner Inner = new Inner ();Inner.inner_f2 ();}public static void Main (string[] args) {New Outer (). OUTER_F3 ();}}Generating a static inner class does not require an external class member: This is the difference between a static inner class and a member inner class. Objects of the static inner
Speaking of the word internal class, presumably a lot of people are not unfamiliar, but will feel unfamiliar. The reason is that there are not many scenarios that can be used when writing code, most of it is in the case of event monitoring, and it is seldom used to summarize the usage of internal classes. I. Inner-class basis In Java, a
Java Virtual Machine class loading mechanism-Reading Notes for a deep understanding of Java Virtual Machine
The Class loading mechanism of java Virtual Machine loads Class files to the memory, verifies, converts, parses, and initi
First, prefaceThe inner class is also called a parasitic class, which is to put a class inside a class (that is, the upper-level program unit of the inner class is the class) definition, as a member of the outer
Java study notes 9-internal class summary, study notes 9 --
Java learning notes series:
Java study note 8-interface Summary
Java study notes 7 -- abstract classes and abstract methods
Java study Note 6-
be modified with the final keyword, that is, immutable variables. In java SE8, local classes can use local variables that are essentially unchanged. That is, even if the local variables are not modified by the final keyword, their values have never changed since the initialization.
Starting from Java 8, local classes can also use the parameters of their methods.
Similar to internal classes, local classes c
An inner class is the definition of a class within an external class. The class name does not need to be the same as the folder.* Internal classes can be static, or public,default,protected and private adornments. (The external top-level class, which is the same as the
The Java inner class is divided into 4 sections, namely, overview, member inner class, local inner class, and anonymous inner class.In this article is the local inner class of the Java
The Java inner class is divided into 4 sections, namely, overview, member inner class, local inner class, and anonymous inner class.In this article, it is the inner class of a member of the Ja
modified, it is equivalent to an external class, and there will be access limitations. Only static members in the external class can be accessed.
Note: If the internal class defines static members, the internal class must be static.
After the internal class is compiled
These days reading, began to see the Java inside the class, began to think back to see, you can read, the results see the time to monitor there is also no read.In other words, I write Java code has a problem, it may be written in C + + and C written more, is like to each of the classes are written in a separate file.There is no problem with nesting or a file that
Inner class:The normal class is defined in the outermost of a. Java text file, that is, defining a class that has no elements outside of the {} scope, but An inner class is a class that is defined inside a class. Why does
inner class method can access the data in the scope where the class definition resides, including private data2: Inner classes can be hidden from other classes in the same package3: Using anonymous inner classes is convenient when you want to define a callback function and don't want to write a lot of code6.4.1 accessing object state using an internal classAn ob
Summary: 1. The first benefit of the internal class is to hide the operations you don't want others to know, that is, encapsulation.2. An internal class object can access the content of its external class object, and even include private variables! This is a very useful feature,Java uses the following format to express
are actually abstract and cannot be used to create enumeration values. Therefore, when declaring enumeration values, abstract methods are implemented. This is actually the implementation of anonymous internal classes, the curly braces are a class body. Let's take a look at the compiled files.
Five class files are generated in symbiosis, which proves that PLU
Java programming ideology note (6)-internal class, java programming ideology
1. DefinitionA class is defined inside another class. This class is called an internal class.
2. Link to the
, if a class is only used once in this program, it can be defined as an anonymous internal class. The anonymous internal class is developed on the Inheritance of abstract classes and interfaces, it often plays an important role in implementing multi-state operations. In Andr
Inner class concept: As the name implies, a class is defined inside another class. The inner class is called an inner class.The main features of the inner class are:1. Inner classes can be very well hidden and can use protected, private modifiers.2. An inner
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.