Given that this is quite a common process required for non-graphical user interfaces, you might want to create a class specifically for handling keyboard input.
To use the class, you would do something like this...
KeyboardInput keyIn = new KeyboardInput();
keyIn.prompt("Type in a...
If you wish only the subclasses of A to be able to manipulate the array, you should declare the array protected. This effectively makes it private except to any subclasses which have public access to it.
If you wish objects created from X, Y and Z to have shared access to the same array stored...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.