• Slider Banner

    The Programming World

    Learn about top programming languages, tools and frameworks.

    Read more
  • Slider Banner

    Certification MCQ

    Practice for certification from 1000+ multiple choice questions.

    Read more
  • Slider Banner

    Prepare for Technical Interview

    Over 1 Million+ interview questions for different technical profiles.

    Read more

What is the difference between length and length() in java ?

length: Length is a variable in java which is used to find the length of the array. Example:

int[] a = new int[6];
int l = a.length;     // l = 6

length(): It is a final method of String class which is used to find the length of the string. Example:

String s = "Vinay";
int l = s.length(); //l=5;
Subscribe to