有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java缺少返回语句错误,我不知道是什么错误

这是密码

class Car
{
    public static String owner;
    public static String car;
    public static Integer plate_num;
    public static String car_color;

    Car(String owner, String car_name, Integer num, String color)
    {
        owner = owner;
        car = car_name;
        plate_num = num;
        car_color = color;
    }

    Void display ()
    {
        System.out.println("The owner of the car is  "+ owner + "and Car model is " + car);

        System.out.println("The  car number is  "+ plate_num + "and Car color is " + car_color);
    } // ---> here is the error

    public static void main (String args[])
    {
        Car car1 = new Car("MAriam", "Mini Cooper", 124834, "Navey");

        car1.display()  ;

        //System.out.println("Y3es");
    }
}

共 (1) 个答案

  1. # 1 楼答案

    这是Void报税单Void实际上是一个类

    为了解决你的问题,你必须把它改成小写的void


    资源: