Created
October 4, 2018 06:05
-
-
Save dgreenhalgh/ecb25561d711769d4ab45e981a173a7d to your computer and use it in GitHub Desktop.
Big Nerd Ranch Java Interoperability - Jhava
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlin.Unit; | |
import kotlin.jvm.functions.Function1; | |
import org.jetbrains.annotations.NotNull; | |
import org.jetbrains.annotations.Nullable; | |
import java.io.IOException; | |
import java.util.function.Function; | |
public class Jhava { | |
private int hitPoints = 52489112; | |
private String greeting = "BLARGH"; | |
public static void main(String[] args) { | |
System.out.println(Hero.makeProclamation()); | |
System.out.println("Spells:"); | |
Spellbook spellbook = new Spellbook(); | |
for (String spell : spellbook.spells) { | |
System.out.println(spell); | |
} | |
System.out.println("Max spell count: " + Spellbook.MAX_SPELL_COUNT); | |
Spellbook.getSpellbookGreeting(); | |
Function1<String, Unit> translator = Hero.getTranslator(); | |
translator.invoke("TRUCE"); | |
} | |
@NotNull | |
public String utterGreeting() { | |
return greeting; | |
} | |
@Nullable | |
public String determineFriendshipLevel() { | |
return null; | |
} | |
public int getHitPoints() { | |
return hitPoints; | |
} | |
public String getGreeting() { | |
return greeting; | |
} | |
public void setGreeting(String greeting) { | |
this.greeting = greeting; | |
} | |
public void offerFood() { | |
Hero.handOverFood("pizza"); | |
} | |
public void extendHandInFriendship() throws Exception { | |
throw new Exception(); | |
} | |
public void apologize() { | |
try { | |
Hero.acceptApology(); | |
} catch (IOException e) { | |
System.out.println("Caught!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment