Can I access one object from another?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jake Bailey

    Can I access one object from another?

    In my main class (really long), I create a Settings object (a JFrame) and a Game object.

    What I would like to know is if it's possible to have that JFrame access methods in the Game object, without adding more methods to the main class.

    For example:

    Code:
    public class Tester {
    
    	public static void main(String[] args) {
    
    		ClassA objectA = new ClassA();
    		ClassB objectB = new ClassB();
    
    	}
    
    }
    And then objectA can execute methods in objectB without having to call a method from Tester which then calls the method from objectB.
Working...