What is the general relationship between Java classes? (non-aggregated combination)
巴扎黑
巴扎黑 2017-05-17 10:00:56
0
1
1054

After understanding the relationship between java classes, we have basically understood the aggregation and combination relationships, but association relationships In addition to aggregation and combination general association relationships are What kind of thing?

Since the association relationship is an ownership relationship, in addition to the combination relationship and aggregation relationship, what are the remaining general association relationships like. . . (Best code, please)

My Baidu explains combination and aggregation. Are there only combination and aggregation in related relationships?
It is said on the Internet that combination and aggregation are special relationships, but it is not said that relationships are divided into these two types. I can't think of other relationships besides these two.

巴扎黑
巴扎黑

reply all(1)
世界只因有你
  • Inheritance relationship (subclass inherits the functions of parent class and parent interface) is clearly identified with extends

class SuperClass{//这是父类}
// 使用extends 继承父类的功能
class SubClass extends SuperClass{//这是之类}
  1. To implement the relationship and implement the interface excuse, use the implement identifier

interface Classb{//这是接口,用interface申明}
class Classc implement Classb{// 用implement 来实现接口内的功能能}
  1. Dependency For example: Class b needs to be used as a parameter in class a

public class Classb{}
class Classc
{
    public static void method(Classb a)
    // 在这里使用了Classb的对象作为了参数
     {
     System.out.println(a);
     }
}
  1. Association Relationship: Association reflects a strong dependency relationship at the semantic level between two classes, such as me and my friend. This relationship is stronger than dependence. There is no contingency of dependence, and the relationship is not temporary. It is generally long-term, and the relationship between both parties is generally equal.

The rest is what you call the relationship between combination and aggregation

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template