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.
Atlassian recently migrated 4 million Jira databases to Amazon Aurora, intending to reduce costs and improve the reliability of its Jira Cloud platform. Due to the large number of files involved and the constraints of managed services, the team developed a custom tool to orchestrate the process, as traditional cloud migration strategies were not viable.
By Renato LosioLM Studio has released version 0.3.17, introducing support for the Model Context Protocol (MCP) — a step forward in enabling language models to access external tools and data sources. Originally developed by Anthropic, MCP defines a standardized interface for connecting LLMs to services such as GitHub, Notion, or Stripe, enabling more powerful, contextual reasoning.
By Robert KrzaczyńskiGrafana released Tempo 2.8 on June 12, 2025, introducing substantial memory optimizations and expanded functionality in its trace query language, TraceQL. This update is part of an ongoing effort to make distributed tracing more performant and accessible within observability stacks.
By Craig RisiLaunched in early preview last May, Gemma 3n is now officially available. It targets mobile-first, on-device AI applications, using new techniques designed to increase efficiency and improve performance, such as per-layer embeddings and transformer nesting.
By Sergio De SimoneIn this article, we explore how AI agents are reshaping software development and the impact they have on a developer’s workflow. We introduce a practical approach to staying in control while working with these tools by adopting key best practices from the discipline of software architecture, including defining an implementation plan, splitting tasks, and so on.
By Enrico Piccinin
© 2025 Created by Michael Levin.
Powered by