Skip to content

Instantly share code, notes, and snippets.

@affandes
Created March 21, 2020 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save affandes/50a56b8c38cfae20476bde2e8cac3994 to your computer and use it in GitHub Desktop.
Save affandes/50a56b8c38cfae20476bde2e8cac3994 to your computer and use it in GitHub Desktop.
Hello Java,
Ini adalah teks dari file
yang jauh disana.
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