Scala does not have static methods and static fields. You can use the object syntax to achieve the same purpose.
object Accounts{ private var lastNumber = 0 def newUniqueNumber()={lastNumber+=1;lastNumber} } object MySecond { def main(args:Array[Int]): Unit = { val chatter = new Network val myFace = new Network System.out.println("zzz"); Accounts.newUniqueNumber() } }
Because of the apply method, we can use Fraction(3,4) to construct a fraction instead of new Fraction(3,4)