How do I create a "global variable" in Java such that all classes can access it?
- by Chrystle Soh
here's my problem: I have multiple classes that are part of the same package and they need access to a certain file path
String filePath = "D:/Users/Mine/School/Java/CZ2002_Assignment/src/"
Rather than declaring the same Filepath in every single class, is it possible to simply have a "global" type of variable of this FilePath so that all classes can access it and I only need to declare and update it once.
Thanks