aspose file tools*
The moose likes Beginning Java and the fly likes length method not with braces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "length method not with braces" Watch "length method not with braces" New topic
Author

length method not with braces

shivam aggarwal
Greenhorn

Joined: Oct 15, 2009
Posts: 8
why is 'length' method not used with usual braces,unlike other methods?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

If you are talking about the .length attribute of arrays, the answer is pretty simple - it's not a method. You might say it's something like a public final int field - you can read it but not change it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
samir singha
Greenhorn

Joined: Mar 17, 2008
Posts: 23
If you use String in your code you will find length() method with braces.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
Braces look like this: {}

What you showed () are called parentheses (in America) or sometimes (round) brackets (in Britain), never braces.
samir singha
Greenhorn

Joined: Mar 17, 2008
Posts: 23
You are right ritchie. Though I knew the differance, I have done the mistake unknowingly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: length method not with braces