Last active
July 29, 2022 06:46
-
-
Save melvincabatuan/53233d185f86c70c07dadfaeb1131304 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package ph.edu.dlsu.lbycpei; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
// METHOD 1: Hardcoded ASCII Art | |
String ascii1 = """ | |
+------------+ _________________ | |
| | / \\ | |
| _______ | AUGH, I'M DEAD. | | |
| / X X \\ / \\_________________/ | |
| | . | / | |
| | ___ | | |
| \\_______/ | |
| | | |
| \\\\----+----// | |
| | | |
| | | |
| / \\ | |
| / \\ | |
| __/ \\__ | |
| | |
---+--- | |
####### | |
"""; | |
System.out.println(ascii1); | |
// METHOD 2: Java file reading | |
int guessCount = 0; | |
File file = new File("assets/display" + guessCount + ".txt"); | |
Scanner scanner = null; | |
try { | |
scanner = new Scanner(file); | |
// int line_counter = 1; | |
while (scanner.hasNextLine()) { | |
String data = scanner.nextLine(); | |
System.out.println(data); | |
// line_counter++; | |
} | |
scanner.close(); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment