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.

Diverse and empowered teams are impactful teams, Natan Žabkar Nordberg mentioned in his talk on creating impactful software teams at QCon London. A session 0 helps set expectations and ensures that everyone is approaching the team in a compatible way.
By Ben Linders
WhatsApp has rewritten its media handling library in Rust, replacing 160,000 lines of C++ with 90,000 lines of memory-safe code for 3 billion devices. The rollout, part of a system called Kaleidoscope, uses differential fuzzing to ensure bug-for-bug compatibility. The move mirrors a decade-long industry shift toward memory safety, tracing back to Mozilla's first Rust MP4 parser deployment in 2016.
By Steef-Jan Wiggers
AI‑generated code creates implicit architectural decisions, forcing teams to rely on experimentation to validate quality attributes. To get useful results from AI, teams must clearly express trade‑offs and reasoning so the model can generate solutions aligned with desired QARs.
By Pierre Pureur, Kurt Bittner
Thiago Ghisi explains the structural shifts required as an engineering org scales from 30 to 100+ engineers. He shares how to transition from managing performance to building opinionated leadership teams and shaping long-term culture. He discusses his "Three Levels of Impact" framework - Org, Skip-Level, and Company - to help leaders drive strategy and secure high-level promotions.
By Thiago GhisiAI coding assistants promise speed, but what do they mean for quality, trust, and the architect’s craft? In this inaugural episode of Next Gen Architecture Playbook, Shweta Vohra and Grady Booch explore a principled view of how architecture must evolve when machines begin writing code alongside humans. They unpack the third golden age of software engineering, where productivity gains are real.
By Grady Booch
© 2026 Created by Michael Levin.
Powered by