Note that there are some explanatory texts on larger screens.

plurals
  1. POExchanging data between 2 methods in 2 different classes
    text
    copied!<p>Im quite new to Java and this might be a basic doubt. But please help. I have a class as below: </p> <pre><code>public class EnterLeaveHandler implements IOtfHandler { public void handle(java.lang.Object ... args) { long time = (Long) args[0]; int func = (Integer) args[1]; int cpuid = (Integer) args[2]; int source = (Integer) args[3]; } </code></pre> <p>I have another class:</p> <pre><code>public class DefFunctionHandler implements IOtfHandler { public void handle(Object... args) { int stream = (Integer) args[0]; int func = (Integer) args[1]; String name = (String) args[2]; int funcgroup = (Integer) args[3]; int source = (Integer) args[4]; } } </code></pre> <p>So like you can see..there are 2 different classes, which have the same method, but receive different data. I need to get an input from the user for the "String name" in <code>DefFunctionHandler</code> class, and I identify the given name with the name in the file that I have...then correlate it with other data in the method like <code>funcgroup</code> and <code>func</code>. The same <code>func</code> is there in the other class too. So I need to make a comparison between them to get the data in the other class like time, etc. </p> <p>So the data in the methods can be compared to the data structure in C...how do I implement such a structure in Java? I read that structs are similar to classes in Java. But in my case, I have the data in methods and not classes. Please tell me how to solve this problem. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload