• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Length of String literal

 
Bharat Makwana
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please can anybody clear my double...

I want to know,what is the length of String literal ? I think String literal are String Object so it does not have any length limitation, am I right ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48940
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look in the Java Virtual Machine Specification, find section 4.10 about limitations, and that tells you that there are actually limits on how large a String literal can be. It is quite a lot longer than "Bhoom Bhole", you will be pleased to hear!

As for lengths of Strings, go through the API specifications, and find "String" on the lower left, and find its methods. It should be easy enough from that to work out how to get its length.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic