In Java:
public interface Foo {
public static final int Bar = 0;
}
And in Scala, how can I create a trait Foo that has Bar, and I can access it as: Foo.Bar?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can create a companion object (to make it the equivalent of static) and define the variable there using the final val keywords (to make it the equivalent of a final constant):
Lots more on this here