View JavaDefaultMethodMultiInheritanceExample
package com.brs;
// THIS DOES NOT COMPILE!!!
public class JavaDefaultMethodMultiInheritanceExample {
public static void main(String[] args) {
MyOtherJavaExample myJavaExample = new MyOtherJavaExample();
myJavaExample.writeOut();
}
}
View ScalaCleverOverrideTraitExample.scala
package com.brs
object ScalaCleverOverrideTraitExample extends App {
val myExample = new MyExample with TraitOne with TraitTwo ;
myExample.writeOut();
}
trait BaseTrait {
def writeOut()
}
View ScalaOverrideTraitExample.scala
package com.brs
object ScalaOverrideTraitExample extends App {
val myExample = new MyExample ;
myExample.writeOut();
}
trait BaseTrait {
def writeOut()
}
View JavaDefaultMethodsExample.java
package com.brs;
public class JavaDefaultMethodsExample {
public static void main(String[] args) {
MyJavaExample myJavaExample = new MyJavaExample();
myJavaExample.writeOut();
}
}
class MyJavaExample implements InterfaceOne {
View ExampleThatLogs.java
package com.brs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Simple class that we use to trigger a log statement.
*/
public class ExampleThatLogs {