• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

length vs length()

 
Anand Divakaran
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when using string objects , when can i use str.length and str.length();
str is a object reference of type string
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may call the "length()" method on a String, and access a "length" member variable on an array. String does not have a "length" member variable as arrays (appear to) have.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic