Hi I am very new to Scala (complete beginner). I have created a package ( I am using sublime text for now)
// TheRoyalty.scala
package royals
class Royalty(name:String, characteristic:String) {
def title():String = {"Sir " + characteristic + "alot" }
def fancyTitle():String = {"Sir " + name + " " + characteristic + "alot"}
}
Then compiled that in Shell
scalac TheRoyalty.scala
a new directory with the same name as the package WAS created. I can see the folder and the royals.class in it. Then I create a new script that needs to use a class from the package
// ImportRoyalty.scala
import royals.Royalty
val royal = new Royalty("Henry", "Laughs")
val title = royal.title()
assert("Sir Laughsalot" == title,
"Expected Sir Laughsalot, Got " + title)
When I try to run the scrip from the shell the following error occurs:
PS C:\Users\olyan_000\Desktop\BBK\SDP_2016\SCALA> scala ImportRoyalty.scala
C:\Users\olyan_000\Desktop\BBK\SDP_2016\SCALA\ImportRoyalty.scala:2: error: not found: value royals import royals.Royalty ^ C:\Users\olyan_000\Desktop\BBK\SDP_2016\SCALA\ImportRoyalty.scala:4: error: not found: type Royalty val royal = new Royalty("Henry", "Laughs") ^ two errors found PS C:\Users\olyan_000\Desktop\BBK\SDP_2016\SCALA>
I don't understand why and I am stuck.Can you please help?