Computer Science, asked by rithipari, 9 months ago

Write a Java program ( that'll have 4 methods including main ()) to accept two strings, remove the first letter of each string and display the 2 strings.

Answers

Answered by Tejas1582
1

Answer:

import java.util.Scanner;

public class tej {

   String String1(String a)

           {

               String one=a,res=null;

               res=one.substring(1);

               return res;

               

   

           }

   String String2(String b)

           {

               String one=b,res=null;

               res=one.substring(1);

               return res;

               

   

           }

   void display(String a,String b)

   {

       System.out.println("the output is");

       String String1,String2;

       String1=a;

       String2=b;

       System.out.println(String1);

       System.out.println(String2);

   }

   public static void main(String args[])

   {

       tej o=new tej();

       Scanner S=new Scanner(System.in);

       System.out.println("Enter first word");

       String s1=S.next();

       System.out.println("Enter second word");

       String s2=S.next();

       String res1=o.String1(s1);

       String res2=o.String2(s2);

       o.display(res1,res2);

   }

   

   

}

Explanation:

Similar questions