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.

ESLint version 10 has removed the legacy eslintrc configuration system, finalizing a long transition to flat config. The update enhances developer experience, especially for plugin authors and monorepo teams, by changing configuration file location and improving JSX reference tracking. Node.js support has been tightened, and new assertion options have been added to the RuleTester API.
By Daniel Curtis
Pinterest engineering teams have deployed a production-ready Model Context Protocol (MCP) ecosystem that allows AI agents to automate complex engineering tasks and integrate diverse internal tools. Domain-specific MCP servers, a central registry, and human-in-the-loop approval improve security, governance, and developer productivity while saving thousands of hours per month.
By Leela Kumili
Sophie Weston explains that technical careers are winding journeys, not straight ladders. Drawing on 30 years of experience, she shares how senior ICs can become "broken combs" by broadening skills in systems thinking and strategy. She discusses the vital role of organizational flexibility and explains how public speaking and community engagement create feedback loops for career success.
By Sophie Weston
Cloudflare has released Dynamic Worker Loader into open beta, offering V8 isolate-based sandboxing for AI-generated code execution. The company claims isolates start in milliseconds, using megabytes of memory, making them roughly 100x faster and up to 100x more memory-efficient than containers. The feature builds on Cloudflare's Code Mode approach.
By Steef-Jan Wiggers
Discovered by FutureSearch researcher Callum McMahon, a supply chain attack against LiteLLM on PyPI resulted in over 40 thousand downloads of a compromised version that installed a malicious payload capable of harvesting and exfiltrating sensitive information. LiteLLM is downloaded roughly 3 million times per day.
By Sergio De Simone
© 2026 Created by Michael Levin.
Powered by