Question: Can I have some help fixing some errors in my JAVA code. 1. public FileChar() { ch = ' '; //error invalid character constant }

Can I have some help fixing some errors in my JAVA code.

1. public FileChar() {

ch = ' '; //error invalid character constant

}

2. public int hashCode() {

return ch.hashCode(); //error cannot invoke hashCode on primitive type char

}

3. public int compareTo(FileChar Char) {

return ch.equals(Char.ch); //error cannot invoke equals(Char) on primitive type char

}

4. public int compareTo(HuffElement he) {

return chCount.equals(he.chCount); //error cannot invoke equals(int) on primitive type int

}

5. public String toString() {

return System.out.println("char: " + ch + "code: " + "count: " + code + chCount); //error cannot return a void result

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!