Made Scala and Java examples more consistent