烦请java 高手指点下

来源:百度知道 编辑:UC知道 时间:2024/06/02 13:32:55
public class b {
static String str = "hello, world!"
public static void main (String[] args) {
System.out.printin (str) ;
}
}
这个程序有误吗

为什么我用dos下在转换的时候提示

b.java:3:';' expected
public static void main (string[] args) }

1 error

如果答案能解决问题再加20分

static String str = "hello, world!" 后面少了分号

改成

public class b {
static String str = "hello, world!" ; //加分号
public static void main (String[] args) {
System.out.printin (str) ;
}
}

呵呵static String str = "hello, world!"
后面没加";"