❮ Previous Next ❯

length vs. length()

length: meant for array to find the length of an array .
length(): meant for String to find the length of a string.
Example: ArrayTest.java
class ArrayTest
public static void main(String[] args)
String[] s={"s", "ss", "sss"};
System.out.println(s.length);         //3
System.out.println(s.length());      //compile time error
System.out.println(s[0].length);     //compile time error
System.out.println(s[0].length());   //1

langth vs length()
❮ Previous Next ❯

Follow Us


Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Email: info@silantechnology.com
      Phone: 0674-2361252
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved