2.1Compiling the example
To compile the example, we use scalac, the Scala compiler. scalac works like most
compilers: it takes a source file as argument, maybe some options, and produces
one or several object files. The object files it produces are standard Java class files.
If we save the above program in a file called HelloWorld.scala, we can compile
it by issuing the following command (the greater-than sign ‘>’ represents the shell
prompt and should not be typed):
> scalac HelloWorld.scala
This will generate a few class files in the current directory. One of them will be called
HelloWorld.class, and contains a class which can be directly executed using the
scala command, as the following section shows.
2.1Compiling the example
To compile the example, we use scalac, the Scala compiler. scalac works like most
compilers: it takes a source file as argument, maybe some options, and produces
one or several object files. The object files it produces are standard Java class files.
If we save the above program in a file called HelloWorld.scala, we can compile
it by issuing the following command (the greater-than sign ‘>’ represents the shell
prompt and should not be typed):
> scalac HelloWorld.scala
This will generate a few class files in the current directory. One of them will be called
HelloWorld.class, and contains a class which can be directly executed using the
scala command, as the following section shows.
การแปล กรุณารอสักครู่..
