5.29.2008

ActionScript compared to Java

Some quick notes comparing ActionScript to Java:

1. ActionScript supports many features familiar to Java developers
  • packages
  • imports
  • static methods and members
  • public, private, protected and package level access
  • constructors
  • inheritance
  • interfaces
  • method overriding
  • exceptions and try/catch/finally blocks
  • reflection

2. Methods may not be overloaded
You may override a method in a subclass but not overload it with a different return type or parameter list

3. Static and dynamic typing are supported
You may declare variables with or without a type. If you declare the type you will have compile-time type checking, otherwise run-time checking only.

4. Abstract classes and methods are not supported
Use an interface or a class with empty method bodies instead.

5. Exception Handling
There are no checked exceptions so you don't have to declare which exceptions may be thrown by a method. There are, however, error events which are reported asynchronously through the ActionScript event mechanism.