Programming Tips - Can can I have static and non-static in the same class?

Date: 2013nov29 Language: Scala Q. Can can I have static and non-static in the same class? A. If a class is all non-static use "class"
class MyClass { def method1() { } }
If a class is all static use "object"
object MyClass { def function1() { } }
If you want to have both use object and class together with the same name. This called a companion object:
object MyClass { var myStaticVar: Int = 9; def function1() { } } class MyClass { var myVar: Int; def method1() { // Call the static thing MyClass.function1(); } }