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 = {
  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
return m;


langth vs length()

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 0674-2361252