Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by berat ( 17 years ago )
public static void comparison(String text,String pattern) throws Exception
{
	String str ="";
	if(text.length() < pattern.length())
	 	throw new Exception ("No comparing pattern cant be bigger than text");
	if((text.isEmpty())  ||	(pattern.isEmpty()))
		throw new Exception ("any of cannot be empty for comparison,comparison is meaningless if any of of become empty");
	if(text.length() > pattern.length())
		for(int i=0;i<pattern.length();i++){
			for(int j=0;j<text.length();j++){
				if(text.substring(j).compareTo(pattern.substring(i))){
				    str=text.substring(i);
				    }
				}	
			}
		System.out.println(""+str);
}
	
 berat@debian:~/workshop/week2$ javac work2.java
work2.java:149: incompatible types
found   : int
required: boolean
				if(text.substring(j).compareTo(pattern.substring(i))){
				                              ^
1 error

how can i fix that errors.I dont understand I look api i look the returning value of that but why it gives required= boolean.

 

Revise this Paste

Your Name: Code Language: