0

Hello everyone.

I'm in need of some help on how the compareTo method works. First I'll give you some background about it. This program was written in eclipse and it's a homework assignment.

I'm trying to compare two Time objects and see which one is greater.

here's the code

import junit.framework.Testcase 
public class Time implements Comparable<Time>

public void compareTest()
    {
        Time blastTime = new Time(12, 45, 43);
        Time o = new Time(10, 32,22);
        blastTime.compareTo(o);
    }

Now this is a JUnit Test case and for some reason it refuses to test it.
Any advice that would lead into the right direction, would be most appreciated.
Thank you

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Bemani_lover
0

it refuses to test it.

Does the code compile without errors?

BTW Time is the name of a Java SE class. You should try to name your classes with different names.

Edited by NormR1

0

It compiles without any problems, but just doesn't want to pick it up. and this is the format my professor wants with how the classes should be named in his instructions.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.