Ever wanted to get the best discounts? Get up to 20% off. View offers

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

10 Free Java Projects for Beginners 2022 [With Source Code]

Posted in Java

What is Java?

Developed and created by John Gosling in1995 in Sun Microsystems, Java is a general-purpose, object-oriented programming language. It was developed and intended to follow the WORA concept which means Write Once Run Anywhere i.e. compiled Java code can run on all platforms that support Java without the need for recompilation. Java offers various applications in the area of mobile development, web application development being the major areas. Apart from this, it has applications in Desktop applications, Web servers and application servers, games, database connection. It also offers its support in embedded systems and scientific applications. Through this article, you will get java projects with source code.

It is selected by most developers for their projects because of their following applications:

  • Simple
  • Object-Oriented
  • Portable
  • Platform independent
  • Secured
  • Robust
  • Architecture neutral
  • Interpreted
  • High Performance
  • Multithreaded
  • Distributed
  • Dynamic

To know more about Java, Checkout this blog post.

Java IDEs to Start Building Projects

There are plenty of Java IDEs and online editors for you to begin developing Java projects. The list below mentions popular editors and IDEs.

IDEs Online Editors
MyEclipse Codiva
IntelliJ IDEA JDoodle
NetBeans Rextester
Dr. Java Online GDB
Blue J Browxy
JDeveloper IDE One

For detailed information about IDEs and editors, you may want to read Java IDEs.

Best Java Projects for Beginners

Check out these top Java Project Ideas to start your Java Programming Journey and Boost up your career with these beginner-level java projects.

1. Smart City Project

Smart City project allows tourists & other visitors to the city by providing information about hotels, transportation facilities, air ticket booking, shopping details, city news etc. Hence it serves as a guide of the city to city visitors. It is a web-based software developed in Java Programming language that solves most of the problems that any new visitor faces when coming to a new city like pathfinding, hotel searching, ticket booking and more.

Source Code: Smart City Project

2. Currency Converter

Currency Convertor

Different countries have different currencies and these currencies have daily variations relative to one another. People must be updated with the latest currency exchange rate while money transfer. So, the currency converter is a mini-Java project that provides a web-based interface for exchanging/converting money from one currency to another. It is developed using Ajax, Java servlets web features. Such applications have used for business, shares & finance-related areas.

* To change this template, choose Tools | Templates
* and open the template in the editor.
package com.exchange;

import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.InputStream;
import java.net.*;
import com.google.gson.*;

* @author pakallis
class Recv
private String lhs;
private String rhs;
private String error;
private String icc;
public Recv(
public String getLhs()
return lhs;
public String getRhs()
return rhs;
public class Convert extends HttpServlet {
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    * @throws ServletException if a servlet-specific error occurs
    * @throws IOException if an I/O error occurs
    protected void processRequest(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String query = "";
        String amount = "";
        String curTo = "";
        String curFrom = "";
        String submit = "";
        String res = "";
        HttpSession session;
        PrintWriter out = resp.getWriter();
        /*Read request parameters*/
        amount = req.getParameter("amount");
        curTo = req.getParameter("to");
        curFrom = req.getParameter("from");
        /*Open a connection to google and read the result*/

        try {
            query = "http://www.google.com/ig/calculator?hl=en&q=" + amount + curFrom + "=?" + curTo;
            URL url = new URL(query);
            InputStreamReader stream = new InputStreamReader(url.openStream());
            BufferedReader in = new BufferedReader(stream);
            String str = "";
            String temp = "";
            while ((temp = in.readLine()) != null) {
                str = str + temp;

            /*Parse the result which is in json format*/
            Gson gson = new Gson();
            Recv st = gson.fromJson(str, Recv.class);
            String rhs = st.getRhs();
            rhs = rhs.replaceAll("�", "");
            /*we do the check in order to print the additional word(millions,billions etc)*/
            StringTokenizer strto = new StringTokenizer(rhs);
            String nextToken;

            nextToken = strto.nextToken();

            if( nextToken.equals("million") || nextToken.equals("billion") || nextToken.equals("trillion"))
                out.println(" "+nextToken);
        } catch (NumberFormatException e) {
            out.println("The given amount is not a valid number");
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    * Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    * @throws ServletException if a servlet-specific error occurs
    * @throws IOException if an I/O error occurs
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    * Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    * @throws ServletException if a servlet-specific error occurs
    * @throws IOException if an I/O error occurs
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    * Returns a short description of the servlet.
    * @return a String containing servlet description
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

3. Number Guessing Game

Number Guessing Game

The fun and easy project “Guess the Number” is a short Java project that allows the user to guess the number generated by the computer & involves the following steps:

  1. The system generates a random number from a given range, say 1 to 100.
  2. The user is prompted to enter their given number in a displayed dialogue box.
  3. The computer then tells if the entered number matches the guesses number or it is higher/lower than the generated number.
  4. The game continues under the user guessing the number.

You can also incorporate further details as:

  • Limiting the number of attempts.
  • Adding more rounds.
  • Displaying score.
  • Giving points based on the number of attempts.

Source Code

package guessinggame;
* Java game “Guess a Number” that allows user to guess a random number that has been generated.
import javax.swing.*;

public class GuessingGame {
   public static void main(String[] args) {
       int computerNumber = (int) (Math.random()*100 + 1);
       int userAnswer = 0;
       System.out.println("The correct guess would be " + computerNumber);
        int count = 1;

       while (userAnswer != computerNumber)
           String response = JOptionPane.showInputDialog(null,
               "Enter a guess between 1 and 100", "Guessing Game", 3);
           userAnswer = Integer.parseInt(response);
           JOptionPane.showMessageDialog(null, ""+ determineGuess(userAnswer, computerNumber, count));

   public static String determineGuess(int userAnswer, int computerNumber, int count){
       if (userAnswer <=0 || userAnswer >100) {
           return "Your guess is invalid";
       else if (userAnswer == computerNumber ){
           return "Correct!\nTotal Guesses: " + count;
       else if (userAnswer > computerNumber) {
           return "Your guess is too high, try again.\nTry Number: " + count;
       else if (userAnswer < computerNumber) {
           return "Your guess is too low, try again.\nTry Number: " + count;
       else {
           return "Your guess is incorrect\nTry Number: " + count;

4. Brick Breaker Game

Brick Breaker Game

Brick Breaker game consists of bricks aligned at the top of the screen. The player is represented as a tiny ball that is placed on a small platform at the bottom of the screen. The platform can be moved around from left to right on the screen with the help of arrow keys on the keyboard. The player uses the platform to keep the ball running. The goal is to break the bricks without missing the ball with your platform. The project makes use of Java swing, OOPS concepts and much more.

Source Code: Brick Breaker Game

5. Data Visualization Software

The presentation creation and visual representation of data in the graphical or pictorial format are referred to as Data Visualization. Data Visualization has become an active field of research & development by being closely related to information graphics and visualization, statistical graphics and scientific visualization.

The project displays the node connectivity in networking in data visualization form. This node connectivity can be located at different locations via mouse or trackpad. The project has the following goals & objectives:

  1. Effective and Clear Communication of information using graphical & pictorial means.
  2. It should have both functionality and Aesthetic.
  3. It should convey ideas effectively & provide necessary insights into complex sets of data & information.

Data Visualization software makes it easier for the user to understand & grasp the information when they are displayed or represented as charts or graphs rather than report pages.

Source Code: Data Visualization Software

6. ATM Interface

ATM Interface

We have all come across ATMs in our cities and it is built on Java. This complex project consists of five different classes and is a console-based application. When the system starts the user is prompted with user id and user pin. On entering the details successfully, then ATM functionalities are unlocked. The project allows to perform following operations:

  1. Transactions History
  2. Withdraw
  3. Deposit
  4. Transfer
  5. Quit

Source Code: ATM Interface

7. Web Server Management System

Named as “E-Space” this webserver management system project deals with the information, maintenance and information management of the webserver. Web servers are considered worthy solutions for the companies in this world of fast-moving e-Commerce websites to make their products available over the web.

The project provides solutions for company’s activeness on the internet by providing server maintenance of the company.

The project has the following objectives:

  1. To identify if the consumer is an individual, business entity or just another web server.
  2. Trace the physical location of the individual, business entity or web server.
  3. Consumer known security & privacy policy.
  4. Identify URL Authorities & URL Names.
  5. Maintain relationships between consumers & company’s web services.

Source Code: Web Server Management System

8. Airline Reservation System

Airline Reservation System

The project is web-based featuring open architecture that means the app keeps up with the dynamic needs of the airline business by addition of new systems & functionality. The project includes online transaction, fares, inventory & e-ticket operations.

The software consists of four key modules i.e. user registration, login, reservation and cancellation. The app allows communication through a TCP/IP network protocol thereby facilitating the usage of internet & intranet communication globally.

The main features of the project are:

  1. Reservation & cancellation of the tickets.
  2. Automation of system functions.
  3. Quick customer responses.
  4. Perform transaction management & routing functions.
  5. Maintain passenger records.

Source Code: Airline Reservation System

9. Online Book Store

This project is mainly developed for bookstores & shops to computerize the book purchasing process as with the development of technology the working mechanism in all stores is under the process of digitization. The aim of the project is to create an efficient & reliable online bookselling & buying platform to help both buyer and seller. It saves buyer time by facilitating access from anywhere & providing home delivery service.

The proposed web-based project also records sold & stock books automatically in the database.

The main features of the project are:

  1. Security: Only registered users can access the Database.
  2. Books can be grouped based on the price, title etc.
  3. The ordered books are safely delivered.
  4. The project is fast & efficient for both the store manager and customer.
  5. The project should be reliable to carry online transactions.

Source Code: Online Book Store

10. Snake Game in Java

Snake Game in Java

If you are a 90’s Kid or an adult you have probably played this game on your phones. Have you ever thought of building this game? The goal of this game is to make the snake eat the tokens which are its food w/o the snake being touched to the boundary on the screen. Every time the snake eats the token the score is updated. The player loses when the snake touches the boundary & the final score is displayed.

Source Code: Snake Game in Java


That brings us to the Java projects that we encounter in our daily lives. Be it playing games, withdrawing money from ATMs, or shopping online or even reserving an airline ticket Java code helps through all these tasks. Java is a robust and secure language and that is what makes it developers’ favourite to carry out such projects. Gaining a fluency to code in Java opens doors to many opportunities. So gear up and try these projects to build up your profile in Java. You could also share your attempt vis GitHub in the comments below. Did you try any other fun projects in Java? Let us know and share it with the community.

Looking to learn Java holistically before starting your first Java project? Java Programming Masterclass udemy course can be your great first stepping stone.

People are also reading:

Simran Kaur Arora

Simran Kaur Arora

Simran works at Hackr as a technical writer. The graduate in MS Computer Science from the well known CS hub, aka Silicon Valley, is also an editor of the website. She enjoys writing about any tech topic, including programming, algorithms, cloud, data science, and AI. Traveling, sketching, and gardening are the hobbies that interest her. View all posts by the Author

Leave a comment

Your email will not be published

I will learn java language for get job.

Pavan gogineni
Pavan gogineni

What is the trending project to do on java


Your Way Of Explanation was good. You add some valuable points. Here I am sharing some information about java. Java is the most popular programming language and works across all computer and mobile platforms without needing to be recompiled. It is one of the top-paying jobs in software development, The one with the Java certification can expect to earn an average of $102,000 per year. This Java Training in Hyderabad is ideal for software developers.APEC Java Training Institute in Hyderabad is a one-stop training program designed to guide you from the beginning concepts of Java to advanced programming techniques. Are looking for Java Training Institute in Hyderabad, you learn Java the right way, APEC Java Training Institute in Hyderabad provides the best coaching for java with real-time coding. Our trainers are industry-experienced, professional Java trainers.
Java training institute in hyderabad


Select from the best sales here