java 不能生成get set方法

使用get set提示
The operation is not applicable to the current selection. Select a field which is
not declared as type variable or a type that declares such fields.

将光标定位到类内部自动生成Set、Get即可
参考: JAVA错误提示:The operation is not applicable to the current selection.Select a field which is not declared as type variable or a type that declares such fields. - 陈彦斌 - 博客园 平时没怎么注意,今天用Eclipse自动生成Set Get方法时提示错误,错误信息如下: The operation is not applicable to the current selectio https://www.cnblogs.com/chenyanbin/p/11651363.html

看你代码如何写的,好帮你分析。
一个类中要先定义属性,才能生成对应的set/get方法。

class Stutent{
    private String name;
    private int age;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
            this.age = age;
    }