my program contains an object and i want to understand how a collections that contains objects is helping me if i can`t use the methods ?
My code that i used :
ClassMain c = new ClassMain();
Map<String, ClassMain> s = new HashMap<>();
s.put("S", c);
Iterator it = s.keySet().iterator();
while(it.hasNext())
{
Object key = it.next();
System.out.println(key);
}
ClassMain :
public static void main(String[] args) {
}
public void print(){
System.out.println("Printing");
}