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.
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 most certainly can have variables in an interface, they are public and static by default, but they are not forbidden! You also do not have to use an abstract class either to implement an interface, you may also use a concrete class!
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.
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().
what does this teach us? you just shows us the diffrence between interfaces and classes.. You used 5 mins. to explain this.. I can do it in 30 seconds.. watch me.. you use the extends statement for classes and the implements statement for interfaces.. When implementing an interface, you have to implement all of it's abstract methods.. that's what you used 5 mins to explain.. -.-'
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.
ya whatever mahboop was talking about ill assume what i find this as. unhealpful really. i might as well read a book on this part would have gotten me farther. faster
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.
axlrose76 19 hours ago
You can have variables, public static final
Tomcs251 7 months ago
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.
cisancr 1 year ago
You can have variables in an interface...must be public static.
mariusz128 1 year ago
Thanks alot for this
dewi20 1 year ago
You most certainly can have variables in an interface, they are public and static by default, but they are not forbidden! You also do not have to use an abstract class either to implement an interface, you may also use a concrete class!
stedav 1 year ago 6
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.
robertmadman 1 year ago
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().
mrknight411 2 years ago
@mrknight411 constants are NOT variables ! get your stuff right
coobedom3 1 year ago
Because I still don't know shit about Interface yet, and I would like to see what they would like for my skeleton
MrXaro 2 years ago
Hey If I send you my code can you make a interface for me? Please and Thank you.
MrXaro 2 years ago
whoa thanks, my lecture took over an hour to example it and made no scenes but here in like 5 mins I got it!
4yumikid 2 years ago
watch it yourself, and find problems of your T
tedtdu 2 years ago
There´s to much movement in this video for my taste. I get so annoyed with that the windows keeps moving around all the time, gives me a headache.
kallianke 2 years ago
Bravo!
MySimon25 2 years ago
Gracias. Desearía que todos los videos de youtube tuvieran una imagen tan buena como este.
jmnsjmnsjmnsjmns 2 years ago
great explaination I got it instantly
SpicyHam 2 years ago
great explanination man (compared to my teacher)
SpicyHam 2 years ago
what does this teach us? you just shows us the diffrence between interfaces and classes.. You used 5 mins. to explain this.. I can do it in 30 seconds.. watch me.. you use the extends statement for classes and the implements statement for interfaces.. When implementing an interface, you have to implement all of it's abstract methods.. that's what you used 5 mins to explain.. -.-'
VimsieCent 2 years ago
you can put static variables in interfaces, but not instance variables
senos64 3 years ago
Yes but don't forget they are Constants so they are static and Final.
stedav 2 years ago
Fascinating. Explain what the point of interfaces are.
evilfrenchguy 3 years ago
Ignore this guys naming conventions - they are all wrong.
rhillner 3 years ago
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 3 years ago 4
No they may not be to the design reccomendations but they are not WRONG, if they were the compiler would complain!
stedav 2 years ago
Explaining the benefits and advantages of interfaces and abstract classes would have been better.
marno21 3 years ago
I agree.
evilfrenchguy 3 years ago
IBM Rational Developer
RULES!!
aestrabajos 3 years ago
public boid????
juajua!!!
aestrabajos 3 years ago
ya whatever mahboop was talking about ill assume what i find this as. unhealpful really. i might as well read a book on this part would have gotten me farther. faster
Nojtb 4 years ago
Interfaces is important in programming
you just defind the methods without implementations
-
we have to define classes that implement the Interface, where you've to implement all the method which you've defined in the Interface
--
thanks Sir
mahboop 4 years ago
hmph
animorten 4 years ago