In this program, string variable fd
doesn't wait taking input.
Can someone help me with this program.
i can get the input if i use the new scanner object though.
import java.util.Scanner;
public class Strmethod {
public static void main(String[] args)
{
String ch,fd;
int s,e;
Scanner sc=new Scanner(System.in);
System.out.print("Enter A String:");
ch=sc.nextLine();
System.out.println("String is "+ch);
System.out.println("Enter Two Numbers For Substring:");
s=sc.nextInt();
e=sc.nextInt();
System.out.println("Substring:"+ch.substring(s,e));
System.out.println("Enter a Word to search:");
fd=sc.nextLine();
System.out.println(ch.contains(f));
String jn=String.join("/","hello","g","u","y","s");
System.out.println(jn);
System.out.println(ch.startsWith("H"));
System.out.println(ch.startsWith("e"));
System.out.println("Length:"+ch.length());
String newstr=ch.replace("Hello","Hey");
System.out.println("String is "+ch);
}
}