Hello.
It is necessary to create a method that would accept any copy of the object!
Is it possible to write a method that would accept and process any type it receives at compile time?
public static void main (String [] strings){ inspector(new User("Kostia","Kostia000","Kostia..Kostikrus90@gmail.com")); inspector(new Message("","")); // And more beans } public static void inspector(Object object) { if(!(object.equals(null))){ if(object instanceof User){ // Make only one method and one check for instance to all incoming type of object instances! Converter<User> typeConverter = new Converter<User>(); User user = typeConverter.convertTo(object); System.out.print(user.toString()); } } } public class Converter<T> { protected T convertTo(Object type){ return (T) type; } }