Unit - 2
Practical - 2
package pl;
import java.util.Scanner;
public class Pl {
public static void main(String[] args) {
String s;
Scanner in =new Scanner(System.in);
System.out.println("Enter String :");
s = in.nextLine();
System.out.println("Length of ths String is :"+s.length());
System.out.print("second half of the sring is:");
System.out.println(s.substring(s.length() / 2));
}
}
output:
Enter String :
gajjar
Length of ths String is :6
second half of the sring is:jar
No comments:
Post a Comment