import java.io.*;
import java.util.*;
public class Length{
Scanner scan=new Scanner(System.in);
String string;
public void input(){
try{
System.out.println("Enter any String to print its length: ");
string=scan.nextLine();
}
catch(Exception e){
System.out.println("Error Code: "+e);
System.exit(0);
}
}
public void compute(){
System.out.println("String's length: "+(string.length()));
}
public static void main(String[] args){
Length obj=new Length();
obj.input();
obj.compute();
}
}
import java.util.*;
public class Length{
Scanner scan=new Scanner(System.in);
String string;
public void input(){
try{
System.out.println("Enter any String to print its length: ");
string=scan.nextLine();
}
catch(Exception e){
System.out.println("Error Code: "+e);
System.exit(0);
}
}
public void compute(){
System.out.println("String's length: "+(string.length()));
}
public static void main(String[] args){
Length obj=new Length();
obj.input();
obj.compute();
}
}
Comments