Am trying to learn Scala. With whatever i could look into so far, i see it mentioned that Scala is pretty compatible with Java. "You can call the methods of either language from methods in the other one". But i just couldn't find a suitable example of a custom Java class being imported into a Scala and used. So am starting to wonder if this is even possible? Could you please advise this newbie?
Am using notepad, and not an editor (had run into many issues in using Eclipse).
I have an Employee class in Java:
package Emp;
class Employee {
String name;
}
And am trying to have this imported in my scala class
import Emp._
object Emp extends Employee{
.......}
But this just does not compile. Wonder if am missing something in concept or syntax; please help.
class Emp extends Employee. An companion object in Scala is somewhat different than a class!Empcan't be object. Companion objects is a different matter.