缺少方法体,或声明抽象

时间:2016-06-23 07:57:27

标签: java

缺少方法体,或在java中声明抽象错误。!!有什么帮助吗?

public class PhraseOMatic {

    public static void main(String[] args) {
        String[] wordListOne = {"come", "are", "let", "let's"};
        String[] wordListTwo = {"to", "you", "it", "hang"};
        String[] wordListThree = {"me", "there", "survive", "out"};

        int oneLength = wordListOne.length;
        int twoLength = wordListTwo.length;
        int threeLength = wordListThree.length;

        int rand1 = (int) (Math.random() * oneLength);
        int rand2 = (int) (Math.random() * twoLength);
        int rand3 = (int) (Math.random() * threeLength);

        String phrase = wordListOne[rand1] + " " + wordListTwo[rand2] + " " + wordListThree[rand3];
        System.out.println("What we need is a :" + phrase);
    }
}

缺少方法体,或在java中声明抽象错误。!!有什么帮助吗?

1 个答案:

答案 0 :(得分:3)

是的,删除;原型行末尾的main(第一行)。编译器认为您要将其声明为abstract而忘记了abstract关键字。

相关问题