Seperate files and methods

'lo All.

Excuse the stupidity (I have a feeling I’ll be saying that in this forum a fair bit) but:

If classes foo and bar in files foo.java and bar.java exist, and the main method is in foo.java in the foo.class, how can I call a method in bar?

I can call myBar = new bar from the main method in foo to create a new instance of a class, but for syntax clarity I’d like to move some of the methods from my ever growing program into other files. I just get cannot resolve symbol.

Regards.

E

Saying you’ve got a method called killWindows() in your bar class, you can call that method from the foo class by calling :

myBar.killWindows();

If you are to novice, you should read the great part from the official Java tutorial named “Learning Java” :slight_smile:

Chman

Thanks, I actually wound up stumbling across the answer after I realised I’d used other stuff from that class by just using classname.resource

Btw: Any question I ask is a last resort, I’ve read through the java tutorial, googled the error messages and have finally come here.

::slight_smile:

[quote]Excuse the stupidity (I have a feeling I’ll be saying that in this forum a fair bit)
[/quote]
Don’t worry, you’re not stupid, just a novice ! And the Newless Clubies is a novice dedicated forum, so you can ask what you want here ! You’ll alwais get some help.

Cheers
Chman