i'm looking to declare a constant in the class, so that it'll be set the first thing when the class is loaded, and won't change.
However, the value it should be set to depends on the content of the file the class reads from a file. The following won't work:
static final int N=someMethod(path);
unless I also have:
static Path path = Paths.get("C:\\Users\\Me\\S2.txt");
If i do this, the param of Paths.get()
will have to be manually changed for each run.
Giving the path name on invocation of Java won't do either-- that's solely
the String[]
argument of the main()
method(?), and main()
doesn't run till later.
Is there a better way of doing this than what i do in the above two lines of code?
TIA