Java

Read Data from a Text File using Java

Submitted by donbermoy on
Today, I will teach you how to read data from a text file using Java. We're done with creating files and writing/appending files, so now we will proceed to reading of data from any files but here we just use the text files or .txt file extension. So, now let's start this tutorial! 1. Open Notepad. Put any data in there, for example, i have write " Sourcecodester is the best!". Save it to the same

Compute Number of Days to Months and Days in Java GUI

Submitted by donbermoy on
This tutorial will teach you how to compute a given number of days to months and days using Java GUI. For example we input a number of days of 65, the equivalent months and days is 2 months and 5 days. So, now let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of monthsDays.java. 2. Import javax.swing package. Hence we will use a GUI (Graphical User Interface) here like the inputting the number of days.

Compute Square Root of a Number in Java GUI

Submitted by donbermoy on
In this tutorial, you will learn how to compute a square root of a number using Java GUI using Math.sqrt function. We all know that square root are number that when multiplied by itself gives a given number. Now let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of sqrRoot.java. 2. Import javax.swing package.

How to Append Data to Text File in Java

Submitted by donbermoy on
In this tutorial, i will teach you how to append data to a text file using Java. I already had tutorial in creating a file, and now, we will put a data to this file. So, now let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of AppendData.java. 2. Import java.io package.

Reverse a Number in Java GUI

Submitted by donbermoy on
In this tutorial, i will going to teach you how to create a program in Java GUI that reverses an inputted number. Now let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of reverse.java. 2. Import javax.swing package. Hence we will use a GUI (Graphical User Interface) here like the inputting the number.

Factorial of a Number using Java GUI

Submitted by donbermoy on
In this tutorial, i will going to teach you how to create a program that computes factorial of a number. We all know that factorial is defined only for natural numbers and it means as the continued product of successive natural numbers from 1 to the number inputted. Now let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of factorial.java. 2. Import javax.swing package.

Palindrome in Java GUI

Submitted by donbermoy on
We all know that palindrome is a word or phrase that reads the same backward as forward. Here in this tutorial, we will create a program that can determine if the word inputted is a palindrome or not. Now, let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of palindrome.java. 2. Import javax.swing package.