Difference Between length and length() in java - FindersAdda : Tutorials of Make Money, Computer or Internet

Friday, 22 September 2017

Difference Between length and length() in java


Hello Friends! How are You? I hope, you will be good. Today, I am present once again with a new post. 

length : - length is a final variable applicable for arrays. This variable represents the size of an array i.e the number of elements stored in an array.



Output of the above program


In multidimensional array, length variable represents only base size but not total size. 





Output of the Above program




length() : - It is a final method. This method is used to find length of String that means it returns length of number of character stored in one object.



Output of the above program




NOTE : - length variable is applicable for arrays but not for String object. Whereas, length() method is applicable for string object but not for arrays.



Final Words

I hope you liked this post so much. If you loved this post, Then, share with your friends and also give some suggestion that what should i improve in this post. Thank You So Much...... 

About Author

SUMIT KUMAR GUPTA
SUMIT KUMAR GUPTA

Author & Editor

Myself Sumit Kumar Gupta & 21 year's old person. I am a programmer and blogger. I spend much more time on programming and blogging and helps other programmers and bloggers.

0 comments:

Post a Comment

We are eager to see your comments.
Comment Rule :

1. Don't use any link in the comment box. If you have any problem related to link then contact me with the contact form.

2. Don't use the wrong word if you write the wrong word in comment box then it will get spam.