java - How to print a specific instance of an object using toString -



java - How to print a specific instance of an object using toString -

how print , specific instance of object using tostring?

so user inputing information. based on input either saved in instance or instance b. both instance , b subclasses overriding tostring methods. input user saved in array. how can create inputs instance of print?

this code have , not working.

public static void printa(abc[] inputs) { for(int = 0; < inputs.length; i++) { if(inputs[i] instanceof a) { joptionpane.showmessagedialog(null, inputs.tostring()); } } }

you need

joptionpane.showmessagedialog(null, inputs[i].tostring());

cuz trying show array.tostring() not value want to.

java arrays abstract-class subclass instanceof

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -