-2

I built an object which is supposed to serialize and deserialize a file. I built it in scala in terminal on mac. I'm new to scala and don't have that much programming experience in general. I was wondering how I could run the object so that it performs the task I assigned it to do. Might be a dumb question but I don't know what to do. Here's an image of what my object is

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • 3
    [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) – Dmytro Mitin Sep 20 '20 at 21:42

1 Answers1

0

Enter in terminal (repl)

serializationTest3.main(Array())

"Running" an object is actually executing the method main(Array[String]): Unit of the object.

Extending trait App

object X extends App {
  foo()
}

is like wrapping the object body with method main

object X {
  def main(args: Array[String]): Unit = {
    foo()
  }
}

https://www.scala-lang.org/api/2.13.3/scala/App.html

How Scala App trait and main works internally?

Difference between object with main() and extends App in scala

Difference between using App trait and main method in scala

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66