Created
March 21, 2020 03:41
-
-
Save affandes/50a56b8c38cfae20476bde2e8cac3994 to your computer and use it in GitHub Desktop.
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
Hello Java, | |
Ini adalah teks dari file | |
yang jauh disana. |
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 java.io.IOException; | |
import java.io.FileReader; | |
public class CharacterStream { | |
public static void main(String[] args) { | |
// Contoh input dari File | |
String file = "hello.txt"; | |
try { | |
// Buat reader | |
FileReader input = new FileReader(file); | |
// Salin input stream ke variabel | |
int first = input.read(); | |
// Variabel siap digunakan | |
System.out.println("first = " + first); | |
}catch (IOException e) { | |
System.out.println("Upps... error yah"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment