java报错Unresolved compilation problems: ?

Exception in thread "main" java.lang.Error: Unresolved compilation problems:

post cannot be resolved or is not a field
post cannot be resolved to a variable
post cannot be resolved to a variable
post cannot be resolved

这是代码:


public class HelloWorld2 {
    public static void main(String[] args) {
        Post.post = new Post();   // 创建博客对象
        post.title = "aa的博客";   // 访问对象属性
        post.content = "这是我的第一篇博客";  //  访问对象属性
        post.print();   // 调用对象方法
    }
}

图片描述

看教程来的,都不知道是什么。。。
谢谢!

阅读 10.5k
2 个回答

目测第一行是Post post = new Post();
如果不是看错了的话,考虑换个教程吧

有全角的空格

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题