Skip to content

Instantly share code, notes, and snippets.

@leesc22
Created June 19, 2018 01:26
Show Gist options
  • Save leesc22/220dbf51e8033f3ec0125c2e6bc6200e to your computer and use it in GitHub Desktop.
Save leesc22/220dbf51e8033f3ec0125c2e6bc6200e to your computer and use it in GitHub Desktop.
Comparison between Java class and Kotlin class
/* Java */
public class Book {
private String title;
private Long isbn;
public Book(String title, Long isbn) {
this.title = title;
this.isbn = isbn;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getIsbn() {
return isbn;
}
public void setIsbn(Long isbn) {
this.isbn = isbn;
}
}
/* Kotlin */
class Book constructor(var title: String, var isbn: Long)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment