Possible Duplicate:
String's Maximum length in Java – calling length() method
I have a string defined as
String xx
Is there any limit for the number of characters that I can assign?
2) I am assigning the user input to this string xx.
70% of the times people give only one word. some times they give a big sentence so want to know is that ok? or is there any better java practices?
A common question you could have searched for but I going to answer it again anyway.
Its Integer.MAX_VALUE or 2^31-1 or about 2 billion. You are more likely to have memory problems before getting to this size. e.g. You need 4 GB for the String and 4 GB to create it.
I suspect all the works of J K Rowling would fit into one string.
I suggest you keep things as simple as possible. Assigning a String reference is about simple as it gets.