3 ms·
Sorry, my fault. It seems in java you can declare constants in interfaces, but this is frowned upon. Interfaces cannot require instance variables to be defin
by terminalcommand 9y ago
Sorry, my fault. It seems in java you can declare constants in interfaces, but this is frowned upon.
Interfaces cannot require instance variables to be defined -- only methods.
(Variables can be defined in interfaces, but they do not behave as might be expected: they are treated as final static.)
(source: https://stackoverflow.com/questions/7311274/attributes-member-variables-in-interfaces https://stackoverflow.com/questions/7311274/attributes-membe...)
(Another useful link explaining that statements resembling instance variables in interfaces are in fact constants: https://coderanch.com/t/178630/certification/Instance-variables-interface https://coderanch.com/t/178630/certification/Instance-variab...)