Codetown ::: a software developer's community
object Hello { def main(args: Array[String]): Unit = {
println("Hello world.")
}
}
powerbookg4:tmp zemian$ scalac Hello.scala powerbookg4:tmp zemian$ scala Hello
Hello world.
Note that Scala main entry program is a "object" instead of "class". "object" in Scala is like a class that define a type, but it force it to be a singleton(only one instance), so it almost like "static" in Java. Your main entry in command line must be an object with the main method defined.
You may turn your source file into a script by enter a expression that invoke the main method on the end of the file, and then run it through "scala" instead of compiling it. For example:
object Hello { def main(args: Array[String]): Unit = {
println("Hello world.")
}
}
Hello.main(args)
powerbookg4:tmp zemian$ scala Hello.scala Hello world.
Note the difference. 1 no compile. 2 you give scala the script file name, not the type name!
Happy programming!
Tags:
Codetown is a social network. It's got blogs, forums, groups, personal pages and more! You might think of Codetown as a funky camper van with lots of compartments for your stuff and a great multimedia system, too! Best of all, Codetown has room for all of your friends.
Created by Michael Levin Dec 18, 2008 at 6:56pm. Last updated by Michael Levin May 4, 2018.
Check out the Codetown Jobs group.
FerretDB has recently announced the availability of FerretDB Cloud, a managed MongoDB-compatible database service built on open source DocumentDB. Targeting developers seeking the first cross-cloud DocumentDB-based solution and an alternative to MongoDB Atlas, FerretDB Cloud is currently available on AWS only.
By Renato LosioDiana Montalion and Cat Morris discuss why large-scale transformations often fail, pinpointing six systemic friction points. They explain how architects can drive change by understanding organizational systems, designing knowledge flow, and architecting relationships. They argue that focusing on outcomes, managing resistance, and adopting a learning-driven mindset are critical to success.
By Cat Morris, Diana MontalionxAI introduced grok-code-fast-1, a model developed specifically for agentic coding workflows.
By Daniel DominguezGoogle Spanner now features a columnar engine, allowing its distributed database to handle both OLTP and OLAP workloads on a single platform. This hybrid architecture eliminates the need for separate data warehouses and ETL pipelines. The engine's columnar storage and vectorized execution accelerate analytical queries up to 200x on live data, which is especially beneficial for AI applications.
By Steef-Jan WiggersArtificial intelligence is impacting the individual work of software developers, how professionals work together in teams, and how software teams are being managed. In this panel, we'll discuss how artificial intelligence is reshaping software development, and what mindset and skills are required for software developers and engineering leaders to become adaptable and resilient in the age of AI.
By Ben Linders, Courtney Nash, Mandy Gu, Hien Luu
© 2025 Created by Michael Levin.
Powered by