title: Using variables of one class in another class JAVA
body: <p>I'm new to java and i couldn't understand it properly. How should i use variables of one class in another class</p>
  
  <p><strong>Example:</strong> I need a program to add 2 numbers. I want to have an input class that takes input and the main method in other class should use the variables from input class to perform addition.
  this is totally wrong how to correct?</p>
  
  <p><a href="https://i.stack.imgur.com/02q4Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/02q4Q.jpg" alt="this wrong"></a>
  <a href="https://i.stack.imgur.com/j5Hrx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j5Hrx.jpg" alt="enter image description here"></a></p>