JAVA-oriented OOP and oop
I haven't posted a blog for a while. I am very tired every time, but I feel very full ..
Recently, I have found that many beginners are familiar with object-oriented programming and are not very clear about how classes are converted into objects. Today I am going to talk about my understanding here, let's study it together...
To under
Outline:
Java programming thought Chapter One object introduction extract the basic idea of OOP OOP and process-oriented difference OOP solves the problem. OOP performance in Java
excerpts from the introduction to the first chapt
differences to achieve the same principle, function the same, can be used the main difference:? Hashtable inherit dictionary class, HashMap implement Map interface? Hashtable thread safety, HashMap thread is not secure?Hashtable does not allow null values, HASHMAP allows null values 9. Iterator Iterator Method 1: Iterate through the iterator implementation of the Iterator:collection () method to get the iterate interface Iterator method? Booleanhasnext (): Determine if there is another accessib
Memory Management in object-oriented Class 2.1 file nameA class file is a code file that is suffixed with. Java, allowing only one public class to appear in each class file.When there is a public class, the name of the class file must be the same as the name of the public class, and if no public exists,The name of the class file can be any name (names that begin with a number are not allowed). 2.2 stack memory, heap memory, and method area Java's JVM
Note: This article comes from " what is Ooa in Java?" What is Ood? What is OOP? "In Java, what is OOA? What is Ood? What is OOP?OoaObject-oriented Analysis: An object-oriented analytical approachis to analyze the problem according to the object-oriented thought after conducting the system business investigation in a sy
". These people dream that one day the component will somehow drive the programmer out of the historical stage. In the future, the competent "designers" simply use pre-adjusted components, drag and drop the mouse and put the system together. For software tool makers, the idea has another layer of meaning, and they believe that only then will they retain the necessary technology to be able to write such a component.This idea has one of the most fundamental fallacies: it's hard to get a wide welco
Oop
There are three elements of the object
Behavior
What is the interface, what method/field can be used?
State
What happens to the object when the method is called?
The state of an object can be changed only by invoking a method
Identity
How do you differentiate between objects?
The three major relationships of the class
D
, and memory has been allocated in the Java heap, how the object is laid out in heap memory.Taking the hotspot virtual machine as an example, the layout of the object in heap memory is divided into three areas, namely the object header (header), the instance data (Instance), and the alignment fill (Padding). Object headers: The header includes two pieces of information, mark World and metadata pointers, mark World is used to store data for object runt
(i) The origin of OOP ideas in JavaMachine language-Direct computer instructions, instructions, data, addresses are "0" and "1" Composition: can be directly executed by the computer.assembly language-with easy-to-understand and memorable symbols for instructions, data, and registers, the abstraction level is low and programmers need to consider a lot of machine details.High-level language-the natural language of the military, the structure of data and
Hotspot in the source code why the Java object is designed to oop-klass this structure. Just to avoid the creation of a virtual function table for each Java object.
Http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/oops/klass.hpp
VTBL is the main feature of polymorphism, if all instances of a class are common to one vtbl? The polym
#写在前面Following an OOP object-oriented programming of the Russian Block project implementation process, OOP object-oriented programming of the Java game, in fact, writing is very simple, it is easy to understand, and the comments are written very clearly, there are problems, their own private to make up for the learning (by the way 50 deep squat, hey, usually why
: Getdeclaredfiedlds () getdeclaredmethods () ...Returns all properties or methods (Public/protected/default/private), but does not include inherited properties and methodsPractice:The class name represented by a data structure (Collection) is passed through the command line, which dynamically creates the object of the Class (New ArrayList ()) through the reflection mechanism, puts several objects into the data structure, and then traverses the object information in the output data structure.Exa
superclass of c, so it is in class B to find the method of show (b obj), so the output is "b and b".For 9, the same priority will be given to This.show (O), and the show (d Obj) method is not found in class b, so the Super (superclass) of B is found, and class A finds the show (d Obj) method, so the output is "a and d".four, PackageEncapsulation refers to the use of abstract data types to encapsulate data and data-based operations together to form an indivisible independent entity, the data is
Object-oriented Basic concepts1, object-oriented (OOP, OOD) three major features: encapsulation, inheritance, polymorphism. Note that abstraction is not one of the characteristics2, object-oriented programming is to abstract the data, and functional programming is to abstract the behavior. In the real world, data and behavior coexist, and so do programs, so we have to learn both of these programming ways.3, the concept of the class is an abstract conc
Oop is dead, AOP is for the futureThe future of building complex service-based applications will be aspect-oriented programming AOP (Aspect-oriented programming), while object-oriented programming OOP will be an aid.? control Inversion (IOC) mode. This generic pattern is described as an instance method that supports plug-in schemas where objects can be "queried" and they need other objects.? Dependency Inj
started quickly.There are many reasons to tell us not to take the shortcut, to step by step, yes, some things are more complicated, take the shortcut easy problem, but for the Learning programming language, for people this really is not a difficult very complicated problem. Beginners find it difficult because these languages completely subvert previous perceptions and cannot immediately find the connection between actual things in life and programming languages.A lot of things actually have sho
whether it is final. The 7) class member method is only intended for internal invocation of the class and must be private. The 8) class member method is only exposed to the inheriting class, and is limited to protected. description: Any class, method, parameter, variable, strict access to the scope. A wide range of access is not conducive to module decoupling. Think test: If it is a private method, you want to delete it, but a public service method, or a The scope of the variable
an abstract class and override all methods. Then I build a normal class extends this abstract class, and I can do whatever I like. This is the case with the adapter pattern in Java design mode.A, the final modified class is the end state class, cannot be inherited, and the abstract class must be inherited to have its meaning, therefore, final cannot be used to modify the abstract class. B, Final modified method is the final state method, cannot be re
Java is an object-oriented programming language (OOP), and everything is an object.
Several concepts:
1. References, references are used to manipulate objects, manipulation objects need to be referenced to complete, for example, the remote control (reference) controls the TV (object), can exist independently of each other.
String s = "ASDF"; Create reference and initialize.
string s = new String ("Asdf"),
executed, the memory is freed.2. How do I access function private variables? JS, provides a "closure" concept: Inside the function, define a child function, you can use child functions to access the parent function of the private variables. After the operation is done, the child function is returned by return.function Func2(){ varNum= 1;function func3(){varSum=Num+Ten;alert (sum);}returnfunc3;}varF=Func2 ();f ();3, the role of closures:① the private variable of the access function;② allows a fu
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.