I want to take user input into 2 arrays to store names and marks. One of string type to store names and the other of int type for the marks. I can display them using the index of the element of any particular array.
However I want the array to be dynamic and it should be filled by the user and not hard coded. What is the best way to go about it. I want to use arrays and not array lists. I dont want to hard code it.
Re: Dynamic Arrays
Are you sure you want to use arrays? Are you planning to make both arrays the same size and link names to marks by using the same index? That would be a dreadful design - maybe OK if you were programming in Assembler, but a complete waste of Java code.
You can't resize arrays, but you can copy them to new arrays with a new size with java.util.Arrays - look it up in the Java API documentation.
java.util.Arrays - Google Search
edit: just in case you look at the API docs for 1.4 or Java 1.5, 'copyOf' appeared in the Arrays class in Java 6:
Figure out step by step what you want within your program.
If you want user to do some actions then 'scanner' might be good idea to start.