Computer Science, asked by ksaisumedhostlmk, 1 year ago

write a program to extract first five characters of one string and middle five characters of another String and compare them.print 'EQUAL' if they match else print 'NOT EQUAL'. note:the word should have 10 characters.

Answers

Answered by SkullCrusherFC
1
import java.util.Scanner;
class substring 
{
public static void main(String args[])
{
Scanner scan=new Scanner(System.in);
System.out.println("Enter string 1:");
String s1=scan.nextLine();
System.out.println("Enter string2:");
String s2=scan.nextLine();
String res=s1.substring(0,5)+s2.substring(5,10);
}
}

Similar questions