Skip to content

Instantly share code, notes, and snippets.

@boloutaredoubeni
Created May 4, 2016 02:09
Show Gist options
  • Select an option

  • Save boloutaredoubeni/264ee6b9ce796806248fb0a311bfde29 to your computer and use it in GitHub Desktop.

Select an option

Save boloutaredoubeni/264ee6b9ce796806248fb0a311bfde29 to your computer and use it in GitHub Desktop.
Swift vs Java
public class MyClass {
private int myVar;
public MyClass(int myVar) {
this.myVar = myVar;
}
public int myMethod() {
return myVar;
}
public void myOtherMethod() {
/// do something
}
public static void main(String ..args) {
final MyClass myJavaClass = new MyClass(1);
}
}
public class MyClass {
let myVar: Int?
init(_ myVar: Int) {
self.myVar = myVar
}
public func doSometing() {
/// do something
}
}
let myClass = MyClass(9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment