Java简单程序
我出错了你能告诉我这个文件的错误在哪里吗Java简单程序,java,Java,我出错了你能告诉我这个文件的错误在哪里吗 public class IfSample { public static void main(String[] args) { int x,y; x=10; y=20; if(x<y) System.out.println(“x is less than y”); x=x*2; if(x==y) System.out.println(“x n
public class IfSample {
public static void main(String[] args) {
int x,y;
x=10;
y=20;
if(x<y) System.out.println(“x is less than y”);
x=x*2;
if(x==y) System.out.println(“x now equal to y”);
x=x*2;
if(x>y) System.out.println(“x is greater than y”);
// this won’t display anything.
if(x==y) System.out.println(“you won’t see this”);
}
}
公共类IfSample{
公共静态void main(字符串[]args){
int x,y;
x=10;
y=20;
如果(xy)系统输出打印项次(“x大于y”);
//这不会显示任何内容。
如果(x==y)System.out.println(“您不会看到这个”);
}
}
您正在使用这些引号。这就是为什么你会出错。对字符串使用标准双引号
if (x < y)
System.out.println("x is less than y"); // standard double quotes
x = x * 2;
if (x == y)
System.out.println("x now equal to y");
x = x * 2;
if (x > y)
System.out.println("x is greater than y");
// this won’t display anything.
if (x == y)
System.out.println("you won’t see this");
if(xy)
System.out.println(“x大于y”);
//这不会显示任何内容。
如果(x==y)
System.out.println(“您不会看到这个”);
您遇到了什么错误?需要借用一些括号吗?lol?复制--粘贴问题??更改引号。。。将起作用…谢谢Rj已解决:)