title: How can I access a class other than though passing in a method?
body: <p>Let us say we have a class called World. Which contains a class called Data. We also have a third class called Input. If Input.clicked(Event event, int x, int y) were to be called I would not be able to access World which means I can't access Data. How do you go about resolving this?</p>
  
  <p>Another way to ask this might be: How can you access something in a method from another class that can't be changed when what you need to access is not final? </p>
  
  <p>Sorry, I am having a hard time explaining this.</p>
  
  <p><strong>Update bit</strong>: The world class already exists, can't create a new one. It would be inside the Game class.</p>
  
  <p>Here is a code example, not working code. More pseudo.</p>
  
  <pre><code>public class World {
  
    Data data = new Data();
    Input input = new Input();
  
    public void update(float delta) {
      input.getInput();
      input.makeChangesBasedOnInput();
    }
  
    public void render(float delta) {
    }
  }
  
  public class Data {
  
    public int importantNumber; // Static is not an option
                                // For me I have to get a user name... but same idea here
  
    public Data() {
      Random ran = new Random();
      importantNumber = ran.nextInt(1000);
    }
  
  }
  
  public class Input {
  
    Button button = new Button();
  
    public Input() { // passing the World class does not work, ex. public Input(World world) {
      button.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) { // I can't add world here...
          // HERE IS ISSUE
          System.out.println(World.Data.importantNumber);
        }
      }
    }
  
    public void getInput() {
      // MAGIC
    }
  
    public void makeChangesBasedOnInput() {
      // MAGIC
    }
  
  }
  </code></pre>
  
  <p><strong>Update 2:</strong> Here is another example of what I am trying to do with TextButton &amp; ClickListener from libgdx.</p>
  
  <p>statsButton is a TextButton() from libgdx.</p>
  
  <p><img src="https://i.stack.imgur.com/nnTsG.png" alt="enter image description here"></p>