Skip to content
Advertisement

How to send a valid result of an arithmetic operation through DataOutputStream

I have a subprocess class that calculate the sum of two integers and then put it in a DataOutputStream:

JavaScript

when writing the two values of a and b like 12 and 47 respectivley the result is “ei”.

In another hand the mainprocess won’t read that result like an DataInputStream through the ReadInt() line, and it throws an exception :

JavaScript

Advertisement

Answer

It seems that the main process doesn’t communicate really with the subprocess. deleting the package from the two classes and running the main process on cmd avoid the exception.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement