In this tutorial I will show you how the program will ask the user to give a string and then the program will count the number of characters in the given string using Java programming language. I am using eclipse as my IDE and OpenJDK.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
/**
* @author Jake Rodriguez Pomperada,MAED-IT, MIT
* www.jakerpomperada.com www.jakerpompomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippines
*
*/
import java.util.Scanner;
class String_Length_Demo
{
public static void main(String x[])
{
Scanner input=new Scanner(System.in);
System.out.print("\n\n");
System.out.print("\tString Length in Java");
System.out.print("\n\n");
System.out.print("\tGive a String : ");
String str=input.nextLine();
int len=str.length();
System.out.print("\n\n");
System.out.println("\tGive string contains "+len+" characters");
System.out.print("\n\n");
System.out.print("\tEnd of Program");
}
}