Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions