Saturday, 26 July 2014

How to find length of a string in Java

Structure of the Problem Requirements 

In this simple problem we learn how to find out the length of a string in Java. Java language provide builtin function to find the length of any string . Remember when we use string function to find its length then spaces are included in it .

Source Code  

package com.ancodingpoint.ww;

import java.util.Scanner;

public class String_Length {

    public static void main(String[] args) {
        Scanner input = new Scanner (;
        String sentence = "";
        System.out.println(" Enter Your Story ...");
        sentence = input.nextLine();
        System.out.print(" The Total Characters included spaces  in your story are :");

Output of the Program

Java String Programming
Java String Pogramming

Share it Please

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.


Post a Comment