The syntax > in Java

后端 未结 3 594
猫巷女王i
猫巷女王i 2021-01-18 01:28

I have couple of thoughts regarding the following:

public interface MaxStack>

1-Why does the class tha

3条回答
  •  长发绾君心
    2021-01-18 01:58

    "3-What is the difference between > and - if I need to compare bewteen elements in my class, both will be O.K, no?"

    No, both will not be okay. Suppose I have a class Foo which implements Comparable but classes Foo and Bar have no relation to each other. Then Foo cannot compare to other objects of type Foo. > will catch this as a problem. will not.

提交回复
热议问题