Could you elaborate a bit? When I see "let the user", it makes me wonder if you are trying to input what a user is typing. Is it something like that, or are you asking about how a programmer could put colons and spaces into java code?
Could you post the error message? Spaces and colons should not cause any errors. Do you have a small self contained example of code that causes this issue that you could post?