提示variabledeclaratorid expected after this token错误,如何改正

cathen0023 2009-04-26 06:21:03
public class Tutorial01 extends Object {
// some definitions
static String personURI = "http://somewhere/JohnSmith";
static String fullName = "John Smith";

public static void main (String args[]) {
// create an empty model
Model model = ModelFactory.createDefaultModel();

// create the resource
Resource johnSmith = model.createResource(personURI);

// add the property
johnSmith.addProperty(VCARD.FN, fullName);
}
system.our.println("is ok");
}

编译的时候提示如下错误:variabledeclaratorid expected after this token
问题就出在了system.our.println("is ok")这句话,仔细观察可以发现,这个写在了main函数之外。因此被当成了无效的不可被编译的内容
改正方法:将有问题的那句话放到main函数中即可。一定要注意{}的位置!!!
...全文
1460 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧