Java 10: Interfaces
Top Comments
All Comments (33)
-
Finals are constants not variables, and you can have them in an interface. It's very common practice to have an interface called Constants, where you have your constants.
-
As far as I know you can have constants NOT variables. And you can omit public static final, as when you declare a variable in an interface, they immediately become public static final, another words, a constant.
-
According to Chapter 9 of the Java Language Specification, it is proper style to declare an interface's methods without keywords public and abstract because they are redundant in interface method declarations. Similarly, constants should be declared without keywords public, static and final because they, too, are redundant.
-
You can have variables in an interface...must be public static.
-
Thanks alot for this
-
constants are NOT variables ! get your stuff right
-
This is not a good tutorial for someone who wants to learn core Java 1) 0:36 - Wrong! You can put variables in an interface. Interface variables are constants, so they're public, static, and final by default. 2) 0:45 - Interface methods are implicitly public and abstract, so no need to use those access modifiers: public void render() == void render().
-
Because I still don't know shit about Interface yet, and I would like to see what they would like for my skeleton
-
Hey If I send you my code can you make a interface for me? Please and Thank you.
- Loading comment...
Who are you to say they are wrong? Just because he may not use the same naming conventions that you choose to use does not mean they are wrong. The important thing is to make sure you are consistent.
Kojow7 in reply to rhillner (Show the comment) 3 years ago 6
You can have variables, public static final
Tomcs251 11 months ago