javaprograms

javaprograms

write a program given string is unique string or not

View Answers

September 27, 2011 at 4:14 PM

public class CheckString{
public static void main(String[] args) {
String str="Where there is will, there is a way";
String stcheck="is";
int count=0;
String arr[]=str.split(" ");
for(int i=0;i<arr.length;i++){
if(arr[i].equals(stcheck)){
    count++;
}
}
if(count==1){
    System.out.println("String is unique.");
}
else{
    System.out.println("String is not unique.");
}
}
 }









Related Tutorials/Questions & Answers:
javaprograms
javaprograms
Advertisements
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms
javaprograms - Java Beginners
javaprograms - Java Beginners
javaprograms - Java Beginners

Ads