为什么在运行时,老是提示str1=buf.nextLine();是错的
import java.util.*;
public class zys9
{
public static void main(String[] args)
{
String str,str2="";
int n,i;
char c,str1;
Scanner buf=new Scanner(System.in);
System.out.print("请输入字符串str:");
str=buf.nextLine();
n=str.length();
System.out.print("请输入一个要消除的字符str1:");
str1=buf.nextLine();
for(i=0;i<n;i++)
{
c=str.charAt(i);
if(str1!=c)
str2=str2+c;
}
System.out.println(str2);
}
}