Last active
September 25, 2016 20:38
-
-
Save oleglomako/929631185f321d3e9ad7e870ddb3962c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.oleglomako.SearchSubString; | |
import java.io.*; | |
public class SearchSubString { | |
public static String readLine() { | |
try { | |
return new BufferedReader(new InputStreamReader(System.in)) | |
.readLine(); | |
} catch (IOException e) { | |
return new String(); | |
} | |
} | |
public static void main(String[] args) { | |
System.out.println("Введите строку 1:"); | |
String firstLine = readLine(); | |
System.out.println("Введите подстроку 2"); | |
String secondLine = readLine(); | |
if (firstLine.indexOf(secondLine) != -1) | |
System.out.println("Строка 1 содержит подстроку 2"); | |
else | |
System.out.println("Строка 1 не содержит подстроку 2"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment