为什么我的变量无法解决?

时间:2017-04-18 06:33:40

标签: java

我在新机器和新相机说变量无法解决之后在eclipse中收到错误。我尝试将编译器更改为1.7并且我仍然遇到此错误。

a

3 个答案:

答案 0 :(得分:2)

你必须写下paranthesis:

    CREATE TABLE `student_subject` (
      `name` varchar(256) DEFAULT NULL,
      `subject` varchar(256) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    --
    -- Dumping data for table `student_subject`
    --

    INSERT INTO `student_subject` (`name`, `subject`) VALUES
    ('James', 'English'),
    ('James', 'Physics'),
    ('Paul', 'Mathematics'),
    ('Paul', 'English'),
    ('Paul', 'English'),
    ('Paul', 'French'),
    ('Jake', 'Mathematics'),
    ('Jake', 'French');

 SELECT name, COUNT(distinct subject) AS "subject_count" 
 FROM student_subject
 GROUP BY name,subject order by name desc

#########output##############

 Name     subject_count
('Jake' , 2),
('James', 2),
('Paul' , 3);

答案 1 :(得分:0)

你必须调用构造函数。类之后的()表示您要调用默认的无参数构造函数。

class Machine {
    public void start(){    
        System.out.println("Machine Started");
    }
}

class Camera extends Machine {
    public void start(){         
        System.out.println("Camera Started");
    }
    public void snap(){
        System.out.println("Photo taken");
    }
}

public class UpdownCasting {
    public static void main(String[] args) {
        Machine machine1 = new Machine();
        Camera camera1 = new Camera(); 
    }

}

答案 2 :(得分:0)

在类名变量之后需要write()