Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
PILIHAN EDITOR
Java

Memahami Java Stream: olah koleksi dengan lebih ringkas

Pelajari alur filter, map, dan collect untuk mengolah data Java dengan kode yang mudah dibaca.

D Tim Diary Coding · 1 menit baca
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

CORE API / CATATAN</>
Core API14 Mar 2006

How do I create and write data into text file?

Here is a code example for creating text file and put some texts in it. This program will create a file called write.txt. To create and write a text file we do the following steps: File file = new File("write.txt"); FileWriter fileWriter = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); Below is the complete code […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API13 Mar 2006

How do I read a text file using BufferedReader?

The code snippet below is an example of how to read a text file using BufferedReader class from the java.io package. This snippet read a text file called README.md and print out its content. To create an instance of java.io.BufferedReader we do the following steps: File file = new File("README.md"); FileReader fileReader = new FileReader(file)); […]

Wayan · 2 menit baca
CORE API / CATATAN</>
Core API08 Mar 2006

How do I read a configuration file using java.util.Properties?

When we have an application that used a text file to store a configuration, and the configuration is typically in a key=value format then we can use java.util.Properties to read that configuration file. Here is an example of a configuration file called app.config: app.name=Properties Sample Code app.version=1.0 The code below show you how to read […]

Wayan · 2 menit baca
CORE API / CATATAN</>
Core API06 Mar 2006

How do I convert a collection object into an array?

To convert collection-based object into an array we can use toArray() or toArray(T[] a) method provided by the implementation of Collection interface such as java.util.ArrayList. package org.kodejava.util; import java.util.List; import java.util.ArrayList; public class CollectionToArrayExample { public static void main(String[] args) { List<String> words = new ArrayList<>(); words.add("Kode"); words.add("Java"); words.add("-"); words.add("Learn"); words.add("Java"); words.add...

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API02 Mar 2006

How do I convert an array into a collection object?

To convert array based data into List / Collection based we can use java.util.Arrays class. This class provides a static method asList(T… a) that converts array into List / Collection. package org.kodejava.util; import java.util.Arrays; import java.util.List; public class ArrayAsListExample { public static void main(String[] args) { String[] words = {"Happy", "New", "Year", "2021"}; List<String> list […]

Wayan · 1 menit baca
CORE API / CATATAN</>
Core API28 Feb 2006

How do I add or subtract a date?

The java.util.Calendar allows us to do a date arithmetic function such as add or subtract a unit of time to the specified date field. The method that done this process is the Calendar.add(int field, int amount). Where the value of the field can be Calendar.DATE, Calendar.MONTH, Calendar.YEAR. So this mean if you want to subtract […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.