public void hello() {
System.out.print("Hello, World!");
}
void hello() {
print("Hello, World!");
}
public void hello(String name){
System.out.print("Hello, " + name + "!");
}
void hello(String name) {
print("Hello, ``name``);
}
public void hello(String name) {
if (name == null) {
name = "World";
}
System.out.print("Hello, " + name + "!");
}
void hello(String name = "World") {
print("Hello, ``name``");
}
public boolean hasItems() {
return true;
}
Boolean hasItems() => true;
public double cube(double x) {
return x * x * x;
}
Float cube(Float x) => x * x * x;
public int sum(int... numbers) { }
void sum(Integer* x) { }
void sum(Integer+ x){}
public class MyClass {
public static void main(String[] args){
}
}
shared void run(){}
public static void main(String[]args){
openFile("file.txt", true);
}
public static File openFile(String filename, boolean readOnly) { }
shared void run(){
openFile(filename = "file.txt";
readOnly = false;
);
}
File openFile(String filename, Boolean readOnly){ }
public static void main(String[]args){
createFile("file.txt");
createFile("file.txt", true);
createFile("file.txt", true, false);
createExecutableFile("file.txt");
}
public static File createFile(String filename) { }
public static File createFile(String filename, boolean appendDate) { }
public static File createFile(String filename, boolean appendDate,
boolean executable) { }
public static File createExecutableFile(String filename) { }
shared void run() {
createFile("file.txt");
createFile("file.txt", true);
createFile("file.txt", true, false);
}
File createFile(String filename, Boolean appendDate = false,
Boolean executable = false){ }
public void init() {
List<String> moduleInferred = create("net");
}
public <T> List<T> createList(T item) { }
shared void run() {
value module = createList<String>("net");
value moduleInferred = createList("net");
}
Array<Type> createList<Type>(Type item){ }
public static void main(String[]args) {
Book book = createBook();
System.out.println(book);
System.out.println("Title: " + book.title);
}
public static Book createBook(){
return new Book("title_01", "author_01");
}
public class Book {
final private String title;
final private String author;
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
@Override
public String toString() {
return "Title: " + title + " Author: " + author;
}
}
shared void run () {
value book = createBook();
print(book);
print("Title: ``book.title``");
}
Book createBook() => Book{ title = "title_01"; author = "author_01";};
shared class Book(shared String title, shared String author){}