Most recent FAQ on top.
Typically students have a lot of questions on assignment. Some common guidelines for homeworks/exams, and clarifications on homeworks will be posted on this page. Please try and get answers to doubts on homeworks from this page. If you don't seek the answer you are looking for contact the TA incharge.
Read the Submission Rules for information on submitting assignments. It is extremely important to follow these instructions in order to get credit for your assignments.
Object a = new Integer(3); Object b = new Integer(4);Integer implements Comparable, and so it should have a compareTo() method for comparison. However, the type of a and b is Object, which does not implement the Comparable. You need to cast a and b to Comparable and then use the compareTo() method.
if (a.compareTo(b) > 0){
//-->will throw an error because a and b are of type Object
}
if ( ((Comparable)a).compareTo((Comparable)b) > 0 ) { // works
}
Note that all the parentheses in the example above are necessary because
casting to Comparable has lower precedence than the dot (".") operator.
However, the casting needs to be done BEFORE the compareTo() method is
called.
Many people seem to be having trouble compiling the code for assignment 0. If you get a "Cannot resolve symbol" error during the compilation of the sources you have a problem with your classpath. Please read the following article that explains what a classpath is and how it will resolve your issue.