What I’m trying to do is have a global variable classes and function can read/write from/to.
What I have now is
import java.lang.*;
import lab1.Global;
public class SecondProgram {
public static void main ( String args[] ) {
System.out.println("hi ");
Global.b[0] = " zero ";
Global.b[1] = " One ";
Global.b[2] = " Two ";
Global.b[3] = " Three ";
}
}
and I created a class to store the global variables
public class Global {
public static String a = "hi" ;
public static String [] b;
}
Of course it is important that the size of the array isn’t a hardcoded constant but a variable I’ll be able to find out at some point and plug in.
I hope you can see from the code what I’m trying to do, and you know how to make it work.
Thanks!
i think this is a far better approach and something to get you started….