I plan to create a simple User Login in java using Arrays to store user and pass (despite I know its not the right way, its just a test). I was wondering how it is possible to keep array values among different classes.
example: I have Main class which array is defined in, Register class which gives value to the array in Main class and Login class which access the array in Main class. But when I create an object of main class to access the array in Login class, values will be reseted. What should I do in order to keep the array values once I create an instance of the class which my array placed in?
any suggestion?
I plan to create a simple User Login in java using Arrays to store
Share
I have many problems and questions with this, but purely to answer your question…If you want a variable to be accessible independent of the instance of the object, use the static keyword.