Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Passing objects between classes.

$
0
0
I have 3 classes in total.

Run.java
- the java class which contains the main method to run the other 2 classes.
public static void main(String[] args)
{toGUI tg = new toGUI();
}


toLogic.java
- no main method, needs to pass methods to toGUI.java

toGUI.java
- no main method. Created an instance of toLogic class private toLogic tlg; and in the toGUI constructor I added in parameters public toGui(toLogic tlg){ }; to accept methods from toLogic class.

However, now the problem is that the main method of Run.java doesn't execute as the constructor of toGUI class has parameters. How do I code the main method in Run.java to execute the object of toGUI class ?

Thanks.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>