hi

i'm having some trouble with objectinputstream. i wanted to know if it is possible to validate whether the contents are string or integers then i also wanted to ask how i could convert the contents to int [].

For the latter i tried converting it to char [] first converting to int [] in a for loop but failed.

Appreciate any assistance

Thanks

You can read the object first and you the following check to see if its an instance of String or Integer class.

if(object instanceof String)
or
if(object instanceof Integer)

and then you can convert using casting.

String a= (String)object

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.