Java Common class, abstract class, interface, object-oriented understanding

Source: Internet
Author: User
Tags class definition

1. Object-Oriented Programming:

The language of object-oriented programming is not only Java, but also:

Simula 67 (the first object-oriented language, supports both single-inheritance and certain meanings of polymorphic and partial dynamic binding);

Smalltalk (the first language that supports dynamic typing, supports single inheritance, polymorphism, and dynamic binding);

EIFFEL (supports multi-inheritance, polymorphism and dynamic binding);

C + + (most of its class-based attributes inherit from Simula. Support multi-inheritance, polymorphism and partial dynamic binding);

C # (also supports single inheritance, with many similarities to Java and C + +, etc.);

Python ([? Pa?θ?n] is an interpreted, object-oriented, dynamic data type of high-level programming language); Ruby (developed by the Japanese, is an open source object-oriented programming server-side scripting language); Scala, a multi-paradigm (MULTI-PARADIGM) programming language, is designed to integrate the various features of object-oriented programming and functional programming. Running on a Java Virtual machine) Process orientedTypical representative of programming language: C language.

Whether object-oriented or process-oriented, is to abstract the real world, in order to solve the problem of the formation of the thinking system.

process-oriented means that when we consider a problem, we consider its implementation in a specific process (transactional process) as a unit:  

Object-oriented means that when we consider a problem, we consider its properties and methods in the object unit:


2. Java class:

Java classes encapsulate properties and methods, and everything depends on classes and objects to make calls. The inside is divided into ordinary classes, abstract classes and interfaces:

① Interface:

1, the interface defines methods and properties;

cannot have constructors, cannot instantiate,
Can inherit multiple interfaces and can be modified with an abstract
2.methods only declare, no method body;
3, the property defaults toPublic Static FIANL, and must have an initialization value;
4, Java8 can define a common method, you can also define an inner class in the interface, define the common method in the inner class ② abstract class:1, abstract class definition methods and properties;
can have a construction method and cannot be instantiated
2.abstract classes can inherit abstract classes, and can only inherit one;
Abstract classes can also inherit a common class;
3, you candefine common methods, but must have method body;
4.property can have no initialization value
③ General class:1, ordinary class can inherit ordinary class,
and can only inheritan ordinary class;
2.ordinary classes can be inherited by abstract classes;
3, Ordinary class cansimultaneous implementation of multiple interfaces

The basic syntax emphasizes understanding, and the latter requires a deep understanding of interface-oriented programming ideas. The small part will also be in the back of a separate article on the interface summary.


Java Common class, abstract class, interface, object-oriented understanding

Related Article

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.