title: An add method to add objects in your custom java class
body: <p>A simple question on Java class </p>
  
  <p>I want to create my class with my own add method which adds an object of a different class.</p>
  
  <p>For eg if my class name is Weapon, I want to create an add method like void add(Gun gun) (Gun being one of my other classes for example)</p>
  
  <p>This would be just like creating your own collection maybe??? if I am not wrong? Like list.add() method, I want to implement my own add method for the Weapon class</p>
  
  <p>So when I instantiate an object of my weapon class, it should be like
  Weapon w = new Weapon(new Gun( ... .. constructor parameters) )</p>
  
  <p>Also I would like to have variants of my add methods. Like a different add method with different parameters like void add(Weapon weapon) ( creating an method to add your own class object )</p>
  
  <p>So I am not sure if this is similar to implementing a collection?? And if it is how do I achieve it? Do I have to extend another class for this?</p>
  
  <p>Apologies if my question confused anyone! :)</p>