Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

how do i link between classes in java? in same project

how do i link between classes in java, ive got one .java file thats the jframe for swing and then one that does algorithms, how do i connect them so algorithm modifies jframe componets??

1 Answer

If you want detail information paste your code. If you want import your algorithm to MyClass.java you need describe it. Where you want use your algorithm.class write Algorithm alg = new Algorithm(); Now you can use all class method's or variables using alg variable (alg.doSomething();). Don't forget import your Algorithm class top at MyClass file (import com.my.folder.Algoritm).