User Profile
Collapse
-
Thank you Laharl! Casting to the correct object did the trick. -
I had this thought earlier as well. When I change it, I get this error:
[code=java]Polynomial.java :28: Polynomial.Term is not abstract and does not override abstract method compareTo(java. lang.Object) in java.lang.Compa rable
private class Term implements Comparable[/code]
Also, I don't know if it will make a difference but for the assignment I had to make Term as an inner class of Polynomial. All of the previous...Leave a comment:
-
compareTo Help
I am writing a polynomial class that later I will use to add two polynomials together. Right now I am working on writing the compareTo method (my class implements Comparable). Unfortunately I am getting the following error:
[CODE=JAVA]Polynomial.java :79: cannot find symbol
symbol : variable degree
location: class java.lang.Objec t
if (this.degree == ob1.degree)
... -
Thanks for that code! I changed to the following and everything worked.
[code=java]public static <T extends Number> double standardDeviati on(ArrayList<T> a)
private static <T extends Number> double calcAverage(Arr ayList<T> a)[/code]Leave a comment:
-
If I change it to static I get the following error:
[code=java]MyStatisticsCla ss.java:37: non-static class T cannot be referenced from a static context
public static double standardDeviati on(ArrayList<T> a)[/code]...Leave a comment:
-
Generics Help
I am working on an assignment to write a generic class called MyStatisticsCla ss with type parameter T where T is a numeric object. with a method called standardDeviati on that takes a ArrayList of type T and returns a double. I am getting the following error when I try to compile:
[code=java]MyStatisticsCla ss.java:27: standardDeviati on(java.util.Ar rayList<T>) in MyStatisticsCla ss<T> cannot be applied to (java.util.Arra yList<java.lang .Double>)...
No activity results to display
Show More
Leave a comment: