I see that traits in Scala are similar to interfaces in Java (but interfaces in Java extend other interfaces, they don’t extend a class). I saw an example on SO about traits usage where a trait extends a class.
What is the purpose of this? Why can traits extend classes?
Yes they can, a
traitthat extends aclassputs a restriction on whatclassescan extend thattrait– namely, allclassesthat mix-in thattraitmust extend thatclass.