提示variabledeclaratorid expected after this token错误,如何改正
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函数中即可。一定要注意{}的位置!!!