0
What is the syntax of a composition in java? Can anyone help me
3 Answers
+ 2
Composition is a type of association, a technique which establishes has-a relationship in classes.
class Student {
int id;
String name;
String dept;
}
You can say Student has-a name or Student has-a department.
+ 1
I don't know what you mean by syntax, here is an example which demonstrates it. https://www.javatpoint.com/q/3489/simple-composition-example-program-in-java
0
OK I understood it's function but what does syntax really mean?