There are two kinds of common high-level languages: object-oriented and process-oriented, the typical C, it is a structured language, simply speaking, is to solve a problem, is divided into a number of successive relations of the steps, coherent up can be resolved. For example, put the elephant into the refrigerator program, the process-oriented, the first step: Open the refrigerator; Step two: Put the elephant in the refrigerator; step three: Close the refrigerator door. This is the process-ori
It's all about objects. Manipulating objects with reference to manipulate identifiers in Java are actually "references" to objects. For example, if you want to manipulate a string, you can create a string reference. String S; Here s is just a reference. Storage location base Type/object reference: Stack object: The heap scope scope is determined by {}, which determines theVariable nameVisibility and life cycle.1 {2 int x =12; 3 {4 int/
1. Everything objects2. A program is a collection of objects3. Each object is composed of other objects4. Each object has its type5. The same type of object can receive the same messageIn simple terms: objects have state, behavior, and identityEach object is also given to the service provider, which accomplishes its service by using the services provided by other objectsIn the Java language is a single inheritance1.9 container "
Lesson 7 on JAVA (encapsulation and ideas)Encaplusation ):Indicates to hide the attributes and implementation details of an object and only provide public access.Advantages:1. Isolate changes2. ease of use3. Improve importance4. Improve SecurityEncapsulation principles:1. Hide content that does not need to be provided externally
2. Hide attributes to provide public access
Example code:
Class man {private
Nine, interfaceInterfaces and internal classes provide us with a more structured approach to separating interfaces from implementations.1. Abstract classes and abstract methodsAbstract classes are a kind of moderation between common classes and interfaces. Creating an abstract class is what you want to manipulate a series of classes through this generic interface. Java provides a mechanism called an abstract method , which is incomplete, with only de
an open light, turn off the light, dimming, dimming and other interfaces. To invoke it, you need to create (new) An object that is called through the object's handle.Iv. hiding the implementation of the scheme1, plainly is access control
The same class
Same package
Sub-classes of different packages
Non-subclasses of different packages
Public
can access
can access
can access
can access
Protect
can access
.8.2.1 Method Call BindingAssociating a method call with a method body is called binding.Pre-binding: Before the program executes (implemented by the compiler and the linker), the method call in the C language is pre-bound.Late binding: Also called dynamic binding, run-time binding, which binds the corresponding method body at run time based on the type of the object.The default in Java is dynamic binding, without the need for manual setup. Special: T
, allowing you to precisely control where each element in the list is inserted or removed. The user can access the element based on the integer index of the element (where it is located in the list) and search for the elements in the list.List interface in iterator,add,remove,equals , and hashcode The contract for the method is added with some additional conventions that exceed the conventions specified in the Collection interface. The list interface provides a way to locate (index) access to th
1. Strategy design modeCreating a method that can vary depending on the parameter object being passed is called a policy design pattern. This type of method contains a fixed portion of the algorithm that is requested to execute, and the "policy" contains the changed parts. A policy is a parameter object that is passed in. In the following code example, the process object is a policy. Applied on the S.code example:classProcess { PublicString GetName () {returngetclass (). Getsimplename (); } obje
Exercise 1: (1) Create a class in a package that creates an instance of the class outside the package where the class is located.Import Mil.oms.main.test.Test; Public class maintest {public static void Main (String args[]) { Test test=new test (); } /** Run result test () instantiation ... Package Mil.oms.main.test;public class Test{public Test () {System.out.println ("Test () instantiation ...");}Exercise 2: (1) rewrite the code snippet in this section as a c
2018-04-30Static import (statically imported)Import Static is a new feature of jdk1.5, which can be used to directly use the static method in the package, unlike calling the package name.Grammar:1) import static package name. class or interface name. static member name;2) import static package name. class or interface name. *; The * At this point represents any static member that is used by the current classFor example:In case of import:public static void Main (String args[]) {SYSTEM.OUT.PRINTLN
Do everything with thought, programming is no exception. Before doing BS, now do CS. It is too important to feel the architecture idea, and a good architecture needs to start from the product design to the end of the product. From the framework, the class library to each class, each method. Be aware of yourself and write a method to determine the accessibility of this method and the parameters passed in. Parameters of the time I feel particularly important, must think carefully, now, after, ther
2018-04-30This keywordWhat is this: Represents the current object itself, or an instance of the current class, through which all methods and properties of this object can be called.This is mainly present in two places:1) Constructor: This represents the invocation of the currently created object2) member method: Object A calls the method where this is located, at which point this represents the object aWhen an object is created, the JVM automatically assigns a reference to the current object's t
"; Splitting.split (regex); }}Question NinethPackage Net.mindview.strings.test9;import net.mindview.strings.Splitting;PublicClassTest9 {PublicStaticvoidMain (string[] args) {String regex ="a| e| i| o| U|a|e|i|o|u";//A case-insensitive match can also be enabled through an inline flag expression (? i). String regex1 ="(? i) a|e|i|o|u";//[ABC "denotes a or B or c String regex2 = " (? i) [Aeiou]" ; System. out.println (Splitting.knights.replaceAll (regex, " Span style= "COLOR: #800000" >_ "out.pri
1. Go to the project directory and locate the. project file, open.2. Find the 3, in the 2nd step of the code snippet, add the following label content and save:4. Delete the. setting files from other Eclipsejee Web projects [remember to use Eclipse to create a new] file under the. setting file to copy the following files [in fact, the entire folder is copied over]. jsdtscopeOrg.eclipse.jst.common.project.fac
\classes "3, get the current path of the jar in the Java project and read the configuration information under the path where the jar package is located#java项目打包成jar后, gets the location of the current path to the jar and imports the Config.properties configuration file into the project Properties Prop=new properties ();
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.