I'm writing a little sorting program in Java designed to grab a "student" object and determine what its name, career and classroom is dependent on parameters and attributes. A problem turns up, however, when I try to create the first object. Thus far, everything looks like this:
public class Student {
private String name, classroom;
/**
* The career code is as follows, and I quote:
* 0 - Computer Science
* 1 - Mathematics
* 2 - Physics
* 3 - Biology
*/
private short career, idNumber;
public Student (String name, short career, short idNumber){
this.name = name;
this.classroom = "none";
this.career = career;
this.idNumber = idNumber;
}
public static void main(String args[]){
Student Andreiy = new Student("Andreiy",0,0);
}
}
The error turns up on the object creation line, as for some reason it insist on interpreting 0,0 as integers when the constructor calls for shorts, leading to a mismatch problem.
Any ideas?