首页 > 解决方案 > 在 Debian 10 中执行 Java 时遇到问题

问题描述

大家,我在Debian 10中执行Java时遇到了麻烦

package ddd;

class Clothes {
    String color;
    char size;
}

public class Field {
    public static void main(String[] args) {
        Clothes sun = new Clothes();
        Clothes spring = new Clothes();

        sun.color = "red";
        sun.size = 'S';        
        spring.color = "green";
        spring.size = 'M';

        System.out.printf("sun (%s, %c)%n", sun.color, sun.size);
        System.out.printf("spring (%s, %c)%n", spring.color, spring.size);
    }
}

当我执行它时,系统返回了一个错误:

error: can't find main(String[]) method in class: ddd.Clothes

有人能弄清楚发生了什么吗?

标签: java

解决方案


推荐阅读