#写在前面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
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 core of Java is Object-oriented (fully object-oriented)Object-Oriented ProgrammingYou have to be clear about the three main features of the object1. Behavior of the object2. The state of the object3. Object identificationIn addition, it is necessary to understand the relationship between objects more common relationships haveDependency Inheritance AggregationIn Java programs, programmers should minimize
() method.parsing:add elements to the ArrayList collection with a For loop, there is no error in the code, but the Java virtual machine gives the [], all B is correctparsing:set is an interface to the list at the same level, and there is no inheritance relationship between the two. parsing:The elements in the HashMap collection are unordered.parsing:HashMap is non-thread safe (unsynchronized), allows the key value to be null, and Hashtable is not all
class or interface-to-polymorphic;3. Dynamically create a subclass object based on the user's needs, and returnPackage cn.zzsxt.demo7.factory;//creating a parent class Public Abstract classAXE { Public Abstract voidcut ();} Package cn.zzsxt.demo7.factory;//Create Stone Axe class Public classStoneaxe extends AXE {@Override Public voidCut () {System. out. println ("I am a stone axe, cut Japanese blunt! "); }}package cn.zzsxt.demo7.factory.copy;//creating the Axe class Public classSteelaxe extends
:---------------Characteristics:The function name is the same as the class nameDo not define return value typesThere is no specific return value, and the object is definitely returned after creation.If the class does not have a constructor defined, the JVM allocates an empty construct.If the class defines a constructor, there is no empty construct.Role:Initializes the object.Attention:The characteristics of the default constructor.Multiple constructors exist in the form of overloading.Code block
Object : An instance that has features and functionality. Class : Is an abstraction of an object, a concept in people's mind, a collection of objects with common characteristics or the same behavior, and the use of classes to create objects;Create class: [Modifier] class class name { Create object: Class Name Object name = new class name ();Properties: Similar to variable naming, [modifier] Data Type property name analogy: Scanner input = new Scanner (system.in);Method: [modifier] Returns a valu
Student ();Stu.setnumber (4);Stu.getnumber;Stu.setname ("test");Stu.getname;This is the encapsulation of classes, what are the benefits of encapsulation?1. Good encapsulation can reduce coupling.2. The structure within the class can be freely modified.3. More precise control of member variables is possible:The member variables of a class can be read-only or write-only.such as accessor getxxxx (); modifier setxxxx (); With these, you can control read and write permissions4. Hide the information
Java tutorial translation Sequence Java Introduction Build a JSE development environment-install JDK and eclipse Language basics Java Hello World Program Analysis Variable Java Variables Java Native type Conversion of
Preach Wisdom Blog Video tutorial Download summary |java video tutorial |net video tutorial |php video tutorial | Web video Tutorial
Preach Wisdom Blog Video tutorial Download summary
Java quick tutorial and Java tutorialAuthor: Vamei Source: http://www.cnblogs.com/vamei
Java is an object-oriented language. This language was actually quite young and was only available in 1995, produced by Sun. James Gosling led the Java project team. The project initia
Java quick tutorial and Java tutorial
Author: Vamei Source: http://www.cnblogs.com/vamei
Java is an object-oriented language. This language was actually quite young and was only available in 1995, produced by Sun. James Gosling led the
Basic java tutorial-object-oriented (1), Basic java tutorial
1. Object-oriented
1.1 java keyboard input
1.1.1 In my opinion, this method is the simplest and most powerful, that is, using the struct class.
Import java. util. secret
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.