title: How to give a variable value through another method in another class in Java
body: <p>Simply put here is what I am trying to do:</p>
  <pre><code>class Main { 
      public static void main (String[] args) {
          List option = new List();
          SetGet call = new SetGet();
          option.names();
          call.getName();
      }
  }
  
  class List {
      public void names() {
          SetGet tell = new SetGet();
          tell.setName(&quot;Frank&quot;);
      }
  }
  
  class SetGet() {
      private String info;
  
      String getName() {
          return info;
      }
  
      public void setName(String name) {
          info = name;
      }
  } 
  </code></pre>
  <p>Essentially I have a main method that will tell another method from another class to set the name of something. Yet whenever I request getName from the main method, it always comes back null even though I already set a name for it. This is a really simplified version of what I am trying to do. Any assistance is greatly appreciated.</p>