Practical 4


Aim:- Write a program to find length of string and print second half of the string.

 JAVA Code :-

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

Programs

Home Aim:- Write a program to convert rupees to dollar. (60rupees=1 dollar). Aim:- Write a program that calculate percentage marks...