String Contains - Java Language Basics

Java examples for Language Basics:String

Description

String Contains

Demo Code



public class Main {
        public static void main(String args[]){
                String str1 = "Hello World";
                String str2 = "Hello";
               //  w ww . ja v  a  2 s.c  o m
                boolean blnFound = str1.contains(str2);
                System.out.println("String contains another string? : " + blnFound);
               
        }
}
 

Result


Related Tutorials