30 basic concepts to get started with Java

Source: Internet
Author: User

Three basic concepts to get started with Java

author : brother even java 's white paper presents US with the Java language A key feature.

(1) Easy:java 's syntax is relatively simple compared to C + + , and another aspect is that Java enables software to run on very small machines, and the basic explanation of the size of its support for the class library is about 40kb , adding basic standard libraries and thread-supported memory needs to increase 125kb .

(2) Distributed : Java with a very powerful TCP/IP example of a protocol family, libraries, Java applications can pass URL to access remote objects through the network, because servlet the emergence of mechanisms to make Java programming is very efficient and now many of the big Web Server all support servlet .

(3) OO: Object-oriented design is a programming technique that focuses on the interface of objects and objects . its object-oriented and C + + There are many differences in the handling of multiple inheritance and Java model of the original class.

(4) Robust Features : Java A secure pointer model is adopted to reduce the potential for rewriting memory and data crashes.

(5) Safety : Java to design the network and distribution system, which brings new security issues, Java can be used to build anti-virus and anti-attack System. Facts Prove Java in the aspect of anti-virus is better.

(6) Neutral Architecture : Java compiling its generated architecture-neutral destination file format can be performed on many processors, compiler-generated instruction bytecode (Javabytecode) To implement this attribute, this bytecode can be interpreted on any machine for execution.

(7) Portability : Java there are strict rules for the size and algorithm of the basic data structure type, so portability is good.

(8) Multithreading : Java the process of dealing with multithreading is simple, Java Give the multithreaded implementation to the bottom operating system or the thread program to complete . so multithreading is Java as one of the popular reasons for server-side development language.

(9) Applets and servlets: programs that can be executed on a Web page are called appletsandrequire a lot of Java -enabled browsers, while applets support Dynamic Web pages, which are not available in many other languages.

Basic Concepts

The only relationship in 1.OOP is what the object's interface is, like a computer vendor she doesn't care what the internal structure of the power supply is, he can only supply you with electricity, that is, just know can or not and not how and why. all the programs are composed of a certain property and the behavior of the object, the access of different objects through the function call to complete, all communication between objects is through the method call, through the encapsulation object data, greatly improve the reuse rate.

The most important idea in 2.OOP is the class, the class is the template is the blueprint, constructs an object from the class, namely creates an instance of this class (instance).

3. Encapsulation : is to combine data and behavior in a package , and to hide the data for the object user implementation process, the data in an object called his instance field ( Instance field).

4. by extending a class to obtain a new class called Inheritance (inheritance), all classes are extended by the Object Root superclass, The root superclass is described below.

5. 3 main features of an object

Behavior--- explain what this object can do .

State--- the object's reflection when the object imposes a method .

Identity--- a distinguishing token from other similar behavior objects .

Each object has a unique indentity and these 3 are affected by each other .

6. relationships between Classes :

Use-a: Dependencies

Has-a: Aggregation Relationship

Is-a: Inheritance Relationship -- Example : Class A inherits class B , at which point a class has not only B method of the class, and its own method . ( personality exists in commonness )

7. construct objects using constructors : Constructors are proposed, constructors are a special method of constructing objects and initializing them.

example :D the constructor for the ATA class is called Data

The new Data ()--- constructs an object and initializes the current time .

Data happyday=new data ()--- assigns an object to a variable happyday, so that the object can be used more than once, where the variable to be declared differs from the object variable the value returned by. New is a reference.

constructor features : constructors can have 0 , one or more parameters

constructors and classes have the same name

A class can have more than one constructor

The constructor has no return value

constructors are always used with the new operator .

8. overloading : overloads occur when multiple methods have the same name and have different parameters . the compiler must pick which method to call.

9. Package java allows one or more classes to be gathered together as a group, called a package, to facilitate the organization of tasks, and the standard Java Library is divided into many packages . Java.lang Java.utiljava,net , etc., all java packages are layered in Java and javax in the package hierarchy.

The idea of succession : allowing new classes to be built on top of existing classes, and when you inherit a class that already exists, you reuse the methods and fields of the class, and you can add new methods and fields to the new class.

One. extension classes : the extension class fully embodies the inheritance relationship of is-a . form for : Class ( subclass ) extends ( base class ) .

Polymorphism : in java , the object variable is polymorphic . and Java multiple inheritance is not supported in.

Dynamic binding : A mechanism for invoking object methods.

(1) The compiler checks the type and method name of the object declaration.

(2) The compiler checks the parameter type of the method call.

(3) Static Bindings : If the method type is priavte static Final The compiler will know exactly which method to call.

(4) when a program runs and uses dynamic binding to invoke a method, the virtual machine must call the x The method version that matches the actual type of the object being pointed to.

(5) Dynamic Binding : is a very important feature,


30 basic concepts to get started with Java

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.