Basically im looking to create a simple application that takes in an instruction from the console. The instruction includes the width and length of a grid (x,y), the starting location of a car (x,y on grid), and the instruction to move about on the grid. Essentially an instruction shall look like this:

5 5 2 2 LRLRMRFL

At the moment my program adds this instruction to a string array, this instruction seperated on spaces. Basically i now want to seperate the grid dimensions into a seperate array, and the car location and movements into another.

Anyone have ideas on the best way to program this? Pretty stumped at this point!


Use the String class methods to get the parts of the input String. Use the Integer class method to convert a String part to an int. When the parts are separated they can be put into the places where you want them to go.

Hi friend.. Use the split(reg) method in String class to separate Strings after each space and use parseInt() to access your grid dimensions...