Aim:- Write a program to find length of string and print
second half of the string.
import
java.lang.*;
class
pra4
{
public static void main(String args[])
{
int len;
String
str=new String(args[0]);
len=str.length();
System.out.println("Length of string=
" +len);
System.out.println(str.substring(len/2,len));
}
}
Output:-
No comments:
Post a Comment