Is this the correct way of translating Java interface into Scala?
I am starting to learn Scala and I will do a simple cross compiler. I will support a small set of instructions like print. Note: the code snippets are not tested or compiled. Here is what I would do in JAVA. public interface Compiler{ String getPrintInstruction(); } public class JavaCompiler implements Compiler{ public String getPrintInstruction(){ return "System.out.print(arg0);" } } public class ScalaCompiler implements Compiler{ public String getPrintInstruction(){ return "print(arg0);" } } Is the snippet below the correct "Scala way "? trait Compiler { var printInstruction: String } class