How to find out if this is a class or interface in java by seeing the name?

I like to know how I can find out if this is a class or an interface by seeing the name .. For example, all class names start with capital letters .. the method name starts with a small name .. Is there any specific way to recognize it?

thank

+3
source share
5 answers

Some people make all of their interfaces begin with I. Like IPopupor IController. I personally hate this.

I was taught that the interface should be adjective, the class should be a noun. For example: Class:, ControllerInterface:Controllable

+10
source

. , , . , Sun .

+5

Java . , CamelCase() class lowercase. , - .

+2

, . , java ( JDK) .

+1

It depends on the naming convention. Some people follow IMap and Map; Map and MapImpl; Map and HashMap etc. However, if the name is an adjective (for example, Serializable or Comparable), it is hard to imagine that it will be a class. You can also use java.lang.Class.forName ("MyInterface"). IsInterface () for this purpose.

0
source

Source: https://habr.com/ru/post/1730297/


All Articles