![]() |
Access Classes from different file
Does anyone know how to access java classes from a different file? We have always used only one file for all code but now it's so big so I was wondering if there is any way (I'm sure there is some way but idk) to do that.
Like for "User Messages", we made a class "writeUM". Quote:
Thanks. . |
Re: Access Classes from different file
You can do that quite easily in fact.
package WriteMessage.*; Code:
public class WriteMessage{Code:
import edu.wpi.first.wpilibj.*; |
Re: Access Classes from different file
Neal-
Quick question. Do you mean accessing the class or method outside the file? Because it seems your asking if you can access the method outside the file. If you want to access the class, simply add the import to the top of the file. If you want to access the method, you might have to look towards static methods. P.S. I might be completely wrong, if so correct me. buildmaster, I attempted to run your code... Its a no go, I think because method must be static. |
Re: Access Classes from different file
I actually figured out what I wanted to do. It's basically what you wrote but I made it easier and different.
Thanks though. |
Re: Access Classes from different file
Quote:
Anyways, I figured out what I wanted. And if you failed to run my code, you did something completely wrong as this code is working since forever, I just want the whole "writeUM" thing in a different file. I'm good now. Thanks everyone who tried to help. |
| All times are GMT -5. The time now is 09:35. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi