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

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.