Software Secret Weapons™  
Scala to Java Cheat Sheet posted by Pavel Simakov on 2008-03-21 01:32:40 under Uncategorized
view comments
 


Scala is Java, but there are syntactic differences... Here is my quick Scala to Java cheat sheet to help me remember Scala and how it relates to Java. There are more cheat sheets in the Sundararajan's Weblog.

Java Scala
package com.oy.shared.scala; package com.oy.shared.scala
import java.io.*; import java.io._
public static class HelloObj { ... } object HelloObj { ... }
public class HelloObj { ... } class HelloObj { ... }
System.out.println("Foo!"); println("Foo!");
public class MyClass implements Filter { ... } class MyClass extends Object with Filter { ... }
public void destroy() { ... } def destroy() : Unit = { ... }
void scala.Unit
public void foo(){ ... } def foo() : Unit { ... }
  import Fruits.{Apple => McIntosh, Orange}
public void foo() throws RuntimeException {} @throws(classOf[RuntimeException])
def foo(){ ... }
java.lang.Object scala.AnyRef
   

No comments yet


Leave a comment


  Copyright © 2004-2007 by Pavel Simakov SourceForge.net Logo