Silk programs compile to small Java programs. Silk provides this access through the concept of a Java Literal, which is explained immediately below and then illustrated with several examples at the bottom of this page. The import statement can be used as in Java to allow the package name to be omitted from classes. The following code creates a window with a close button.
Silk defines some helper classes for easily specifying event handlers.
The action for all methods of these interfaces is to call the lambda expression on the event. If the code should run under Java1.1, then the Listener11 constructor should be used instead, as we have done here. This is clearly in violation of the language standard. Strings are implemented as Java strings and so are not mutable. One can use Java StringBuffers to the same effect.