Write a program in java to demonstrate length() method?

import java.util.Scanner;

class StringLength

{

                public static void main(String arg[])

                {

                                Scanner in=new Scanner(System.in);

                                System.out.print("Enter Your Name - ");

                                String s=in.nextLine();

                                System.out.print(s.length());

                }

}

Length Method.PNG

, , , , , ,

Leave a Reply