Compute the diameter, area and circumference of circle in Java This java program has two versions; the console app and with the use of swing library (gui version). The user will be asked to enter the radius of the circle…
Tag: Java tutorials for beginners
Salary Computation in Java
Compute Salary in Java This is a sample java program that will compute your salary based on the basic formula salary = (number of days work * rate per day) – deduction You are going to input your rate per…
Arithmetic operator in Java
Arithmetic operator in Java This is a sample code in java that demonstrate how the four basic arithmetic operators (add, subtract, divide, multiply) works. The program is also coded in console and gui version using swing library. The program will…
Count number of characters in Java
Count number of characters in Java This is an example of java program that will ask you to enter a string, and then the program will count the number of characters of that string. This is also coded in gui…
Sum of Two Numbers in Java
Sum of Two Numbers in Java This is an example of java program that accepts inputs (first number and second number) from the user and computes the sum of two numbers. It’s coded in two versions; the console and gui…
String Concatenation in Java
String Concatenation in Java Concatenation is joining or combining two or more strings. In this java program, we are going to combine two strings to form a single one. This program will accept inputs from the user using the scanner…
Display Date and Time in Java
Display Date and Time in Java Java program that will display the system date and time. You can also modify the format of the time using the SimpleDateFormat class. The program is written in console and gui format.
JOptionPane in Java
JOptionPane in Java A sample program in java that shows the different dialogs of JOptionPane; showMessageDialog which displays a message, showConfirmDialog which shows three options (yes, no and cancel), showInputDialog which allows you to input or enter a text.
Image Button in Java
Image Button in Java This is a gui program in java that demonstrate how to add image to a button. Note: the image and the java file must be on the same directory.