import java.util.Scanner;
public class StringOps
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the string\n");
String s1=sc.nextLine();
System.out.println("What operations do you want to do?\n1.Concat String\n2.Find substring\n3.UpperCase");
int ch=sc.nextInt();
if(ch==1)
{ System.out.println("Enter the string to be concated\n");
String s2=sc.nextLine();
String s4=s1.concat(s2);
System.out.println(s4);
}
else if(ch==2)
{
System.out.println("Enter the string to be searched in the main string\n");
String s3=sc.nextLine();
if(s1.contains(s3))
System.out.println("It is present");
else
System.out.println("Not present");
}
else if(ch==3)
{
System.out.println(s1.toUpperCase());
}
}//end of main
}//end of class
在这里,我对于'concat'语句和'contains'语句的输出不正确。需要纠正什么?