

{"id":115130,"date":"2023-06-23T05:00:04","date_gmt":"2023-06-22T23:30:04","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=115130"},"modified":"2026-06-01T14:24:13","modified_gmt":"2026-06-01T08:54:13","slug":"java-expense-tracker","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/","title":{"rendered":"Java Expense Tracker \u2013 Your Personal Finance Manager"},"content":{"rendered":"<p>In this project, we will be creating an application that can track our expenses. The application will have multiple accounts option so that the user can track their expenses more efficiently. The user can add new expenses with the date, description, and amount of the expense and save it to the database. We will be using Java Swing and SQLite for the database.<\/p>\n<h3>About Java Expense Tracker Application<\/h3>\n<p>This project will provide an understanding of how to create an Expense Tracker app in Java using SQLite as the database. This project will also provide the necessary code to implement the Expense Tracker.<\/p>\n<h3>Prerequisites for Expense Tracker using Java<\/h3>\n<p>1. Eclipse IDE or any IDE of your choice<br \/>\n2. Basics of SQL(Queries to )<br \/>\n3. Java Programming concepts (such as OOP)<br \/>\n4. Basic Knowledge of SQLite and how to use it the Java projects( Needed to download the driver and add it to the project)<\/p>\n<h3>Download Java Expense Tracker Project<\/h3>\n<p>Please download the source code of Java Expense Tracker Project: <a href=\"https:\/\/drive.google.com\/file\/d\/1u2e3cNlf9qBg2Amp206RywnxPgxTX6Qi\/view?usp=drive_link\"><strong>Java Expense Tracker Project Code<\/strong><\/a><\/p>\n<h3>Steps to Create Expense Tracker using Java<\/h3>\n<p>Following are the steps for developing the Java Expense Tracker Project:<\/p>\n<p><strong>Step 1: <\/strong>Create the necessary classes<br \/>\n<strong>Step 2:<\/strong> Importing the necessary libraries<br \/>\n<strong>Step 3:<\/strong> Implementing the entire application<\/p>\n<h4>Step 1: Create the necessary classes:<\/h4>\n<p>For this, we will create only one class named ExpenseTracker.java. In Eclipse, you can do this by Righ clicking on the project folder and Selecting New&gt;Class. You can then provide the necessary details in the popup, such as the package name and the class name itself.<\/p>\n<h4>Step 2: Importing the necessary libraries:<\/h4>\n<p>Below are all the necessary libraries we need :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package training.DataFlair;\r\nimport java.awt.EventQueue;\r\nimport java.sql.Connection;\r\nimport java.sql.PreparedStatement;\r\nimport java.sql.ResultSet;\r\nimport java.sql.SQLException;\r\nimport java.sql.Statement;\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JPanel;\r\nimport javax.swing.JScrollPane;\r\nimport javax.swing.JTable;\r\nimport org.sqlite.SQLiteDataSource;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JComboBox;\r\nimport javax.swing.table.DefaultTableModel;\r\nimport javax.swing.JTextField;\r\nimport javax.swing.JButton;\r\nimport java.awt.event.ActionListener;\r\nimport java.awt.event.ActionEvent;\r\n<\/pre>\n<h4>Step 3: Implementing the entire application:<\/h4>\n<p>Below is the entire code for the application:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package training.DataFlair;\r\nimport java.awt.EventQueue;\r\nimport java.sql.Connection;\r\nimport java.sql.PreparedStatement;\r\nimport java.sql.ResultSet;\r\nimport java.sql.SQLException;\r\nimport java.sql.Statement;\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JPanel;\r\nimport javax.swing.JScrollPane;\r\nimport javax.swing.JTable;\r\nimport org.sqlite.SQLiteDataSource;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JComboBox;\r\nimport javax.swing.table.DefaultTableModel;\r\nimport javax.swing.JTextField;\r\nimport javax.swing.JButton;\r\nimport java.awt.event.ActionListener;\r\nimport java.awt.event.ActionEvent;\r\npublic class ExpenseTracker {\r\n    private static Connection conn;\r\n    private static SQLiteDataSource ds;\r\n    private JFrame frame;\r\n    private JTable table;\r\n    private JTextField dateField;\r\n    private JTextField descField;\r\n    private JTextField amountField;\r\n    private JTextField nameField;\r\n    private int currentAccountId =0;\r\n    \/**\r\n     * Launch the application.\r\n     *\/\r\n    public static void main(String[] args) {\r\n        EventQueue.invokeLater(new Runnable() {\r\n            public void run() {\r\n                try {\r\n                    ExpenseTracker window = new ExpenseTracker();\r\n                    window.frame.setVisible(true);\r\n                } catch (Exception e) {\r\n                    e.printStackTrace();\r\n                }\r\n            }\r\n        });\r\n    }\r\n    \/**\r\n     * Create the application.\r\n     *\/\r\n    public ExpenseTracker() {\r\n        initDB();\r\n        initialize();\r\n    }\r\n\/\/\tMethod to initialize the database and create tables if they do no exist\r\n    private void initDB() {\r\nds = new SQLiteDataSource();\r\n        \r\n        try {\r\nds = new SQLiteDataSource();\r\nds.setUrl(\"jdbc:sqlite:ExpensesDB.db\");\r\n} catch ( Exception e ) {\r\ne.printStackTrace();\r\nSystem.exit(0);\r\n}\r\ntry {\r\n     conn = ds.getConnection();\r\n    \r\n     Statement statement = conn.createStatement();\r\nstatement.executeUpdate(\"CREATE TABLE IF NOT EXISTS accounts (\\n\"\r\n        + \" id INTEGER PRIMARY KEY AUTOINCREMENT,\\n\"\r\n        + \" name TEXT\\n\"\r\n        + \");\\n\"\r\n        + \"CREATE TABLE IF NOT EXISTS expenses (\\n\"\r\n        + \" id INTEGER PRIMARY KEY AUTOINCREMENT,\\n\"\r\n        + \" account_id INTEGER,\\n\"\r\n        + \" date TEXT,\\n\"\r\n        + \" description TEXT,\\n\"\r\n        + \" amount REAL,\\n\"\r\n        + \" FOREIGN KEY (account_id) REFERENCES accounts(id)\\n\"\r\n        + \");\\n\"\r\n        );\r\n\/\/ Closing statement and connection\r\nstatement.close();\r\n     conn.close();\r\n    \r\n}catch ( SQLException e ) {\r\ne.printStackTrace();\r\nSystem.exit( 0 );\r\n}\r\nfinally {\r\ntry {\r\nif (conn != null) {\r\nconn.close();\r\n}\r\n}catch (SQLException e) {\r\nSystem.err.println(e);\r\n}\r\n}\r\n    }\r\n\/\/Method to add account to the database\r\n    private void addAccount(String accountName) {\r\ntry {\r\n\/\/ Open connection to the database\r\n    conn = ds.getConnection();\r\n\/\/ Prepare SQL statement for inserting data into the accounts table\r\nString sql = \"INSERT INTO accounts (name) VALUES (?)\";\r\nPreparedStatement stmt = conn.prepareStatement(sql);\r\n\/\/ Set parameter for the statement\r\nstmt.setString(1, accountName);\r\n\/\/ Execute the statement to insert the data into the table\r\nstmt.executeUpdate();\r\n\/\/ Close the statement and connection\r\nstmt.close();\r\nconn.close();\r\nJOptionPane.showMessageDialog(frame, \"Account Added Successfully\");\r\n} catch (SQLException e) {\r\nJOptionPane.showMessageDialog(frame,\"Error adding account: \" + e.getMessage());\r\n}\r\n}\r\n    \r\n\/\/\tMethod to Load Data from the database into the table\r\n    public void loadData(DefaultTableModel model,int acId) throws SQLException {\r\n        model.setRowCount(0);\r\n        conn = ds.getConnection();\r\n        String sql = \"SELECT date,description,amount FROM expenses WHERE account_id = ? ;\";\r\n        PreparedStatement ps = conn.prepareStatement(sql);\r\n        ps.setInt(1, acId);\r\n        ResultSet rs = ps.executeQuery();\r\n        Object[] row = new Object[3];\r\n        while (rs.next()) {\r\n            for (int i = 0; i &lt; row.length; i++) {\r\n                row[i] = rs.getObject(i+1);\r\n            }\r\n            model.addRow(row);\r\n        }\r\n        ps.close();\r\n        conn.close();\r\n    }\r\n    \r\n\/\/\tmethod to get account details such as account name and total expense from the database\r\n    private String[] getAccountDetails(int accountId) {\r\n        double totalExpense = 0.0;\r\nString accountName = null;\r\n        try {\r\n    conn = ds.getConnection();\r\n\/\/ Prepare SQL statement to retrieve account name\r\nString accountSql = \"SELECT name FROM accounts WHERE id = ?\";\r\nPreparedStatement accountStmt = conn.prepareStatement(accountSql);\r\naccountStmt.setInt(1, accountId);\r\n\/\/ Execute the account statement and retrieve the result\r\nResultSet accountResult = accountStmt.executeQuery();\r\nif (accountResult.next()) {\r\naccountName = accountResult.getString(\"name\");\r\n\/\/ Prepare SQL statement to calculate total expense amount\r\nString expenseSql = \"SELECT SUM(amount) AS total FROM expenses WHERE account_id = ?\";\r\nPreparedStatement expenseStmt = conn.prepareStatement(expenseSql);\r\nexpenseStmt.setInt(1, accountId);\r\n\/\/ Execute the expense statement and retrieve the result\r\nResultSet expenseResult = expenseStmt.executeQuery();\r\nif (expenseResult.next()) {\r\ntotalExpense = expenseResult.getDouble(\"total\");\r\n}\r\nexpenseResult.close();\r\nexpenseStmt.close();\r\n}\r\naccountResult.close();\r\naccountStmt.close();\r\nconn.close();\r\n} catch (SQLException e) {\r\n    JOptionPane.showMessageDialog(frame,\"Error retrieving account details: \" + e.getMessage());\r\n}\r\nString[] detail = {accountName,totalExpense+\"\"};\r\nreturn detail;\r\n}\r\n    \r\n\/\/\tMethod to add the expense into the currently selected account\r\nprivate void addExpense(int accountId, String date, String description, double amount) {\r\ntry {\r\n\/\/ Open connection to the database\r\nconn = ds.getConnection();\r\n\/\/ Prepare SQL statement for inserting data into the expenses table\r\nString sql = \"INSERT INTO expenses (account_id, date, description, amount) VALUES (?, ?, ?, ?)\";\r\nPreparedStatement stmt = conn.prepareStatement(sql);\r\n\/\/ Set parameters for the statement\r\nstmt.setInt(1, accountId);\r\nstmt.setString(2, date);\r\nstmt.setString(3, description);\r\nstmt.setDouble(4, amount);\r\n\/\/ Execute the statement to insert the data into the table\r\nstmt.executeUpdate();\r\n\/\/ Close the statement and connection\r\nstmt.close();\r\nconn.close();\r\nJOptionPane.showMessageDialog(frame,\"Expense added successfully to Account ID: \" + accountId);\r\n} catch (SQLException e) {\r\n    JOptionPane.showMessageDialog(frame,\"Error adding expense: \" + e.getMessage());\r\n}\r\n}\r\n    \r\n\/\/\tMethod to update the comboBox with data from the database\r\n    public void updateCombox(JComboBox&lt;String&gt; cbx) throws SQLException {\r\n        cbx.removeAll();\r\n        conn = ds.getConnection();\r\n        String sql = \"SELECT * FROM accounts;\";\r\n        PreparedStatement ps = conn.prepareStatement(sql);\r\n        ResultSet rs = ps.executeQuery();\r\n        \r\n        \r\n        while(rs.next()) {\r\n            cbx.addItem(rs.getString(\"id\") +\"|\"+ rs.getString(\"name\"));\r\n        }\r\n        rs.close();\r\n        ps.close();\r\n        conn.close();\r\n    }\r\n    \r\n    \r\n    \/**\r\n     * Initialize the contents of the frame.\r\n     *\/\r\n    private void initialize() {\r\n        frame = new JFrame();\r\n        frame.setBounds(100, 100,600, 400);\r\n        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n        frame.getContentPane().setLayout(null);\r\n        frame.setTitle(\"Expense Tracker by DataFlair\");\r\n        \r\n        JPanel toppanel = new JPanel();\r\n        toppanel.setBounds(0, 0, 590, 58);\r\n        frame.getContentPane().add(toppanel);\r\n        toppanel.setLayout(null);\r\n        \r\n        JLabel lblSelectAc = new JLabel(\"Select A\/C:\");\r\n        lblSelectAc.setBounds(0, 0, 75, 15);\r\n        toppanel.add(lblSelectAc);\r\n        \r\n        JComboBox accBox = new JComboBox();\r\n        accBox.setBounds(86, 0, 130, 24);\r\n        toppanel.add(accBox);\r\n        \r\n        JLabel lblName = new JLabel(\"Name:\");\r\n        lblName.setBounds(10, 37, 70, 15);\r\n        toppanel.add(lblName);\r\n        \r\n        nameField = new JTextField();\r\n        nameField.setColumns(10);\r\n        nameField.setBounds(86, 27, 130, 30);\r\n        toppanel.add(nameField);\r\n        \r\n        JButton btnAddAc = new JButton(\"Add A\/C\");\r\n        btnAddAc.addActionListener(new ActionListener() {\r\n            public void actionPerformed(ActionEvent e) {\r\n                addAccount(nameField.getText());\r\n                try {\r\n                    updateCombox(accBox);\r\n                } catch (SQLException e1) {\r\n                    \/\/ TODO Auto-generated catch block\r\n                    e1.printStackTrace();\r\n                }\r\n            }\r\n        });\r\n        btnAddAc.setBounds(223, 27, 117, 30);\r\n        toppanel.add(btnAddAc);\r\n        \r\n        JButton btnSelect = new JButton(\"Select\");\r\n        btnSelect.setBounds(223, 0, 117, 25);\r\n        toppanel.add(btnSelect);\r\n        \r\n        JScrollPane scrollPane = new JScrollPane();\r\n        scrollPane.setEnabled(false);\r\n        scrollPane.setBounds(0, 60, 590, 211);\r\n        frame.getContentPane().add(scrollPane);\r\n        \r\n        table = new JTable();\r\n        table.setBounds(0, 0, 0, 0);\r\n        table.setModel(new DefaultTableModel(\r\n            new Object[][] {\r\n                {null, null, null},\r\n            },\r\n            new String[] {\r\n                \"Date\", \"Description\", \"Amount\"\r\n            }\r\n        ));\r\n        scrollPane.setViewportView(table);\r\n        \r\n        JPanel bottomPanel = new JPanel();\r\n        bottomPanel.setBounds(0, 270, 600, 90);\r\n        frame.getContentPane().add(bottomPanel);\r\n        bottomPanel.setLayout(null);\r\n        \r\n        JLabel dateLabel = new JLabel(\"Date:\");\r\n        dateLabel.setBounds(0, 5, 50, 15);\r\n        bottomPanel.add(dateLabel);\r\n        \r\n        dateField = new JTextField();\r\n        dateField.setBounds(50, 5, 114, 30);\r\n        bottomPanel.add(dateField);\r\n        dateField.setColumns(10);\r\n        \r\n        JLabel descLabel = new JLabel(\"Description:\");\r\n        descLabel.setBounds(180, 5, 90, 15);\r\n        bottomPanel.add(descLabel);\r\n        \r\n        descField = new JTextField();\r\n        descField.setColumns(10);\r\n        descField.setBounds(270, 5, 114, 30);\r\n        bottomPanel.add(descField);\r\n        \r\n        JLabel amountLabel = new JLabel(\"Amount:\");\r\n        amountLabel.setBounds(390, 5, 70, 15);\r\n        bottomPanel.add(amountLabel);\r\n        \r\n        amountField = new JTextField();\r\n        amountField.setColumns(10);\r\n        amountField.setBounds(456, 5, 114, 30);\r\n        bottomPanel.add(amountField);\r\n        \r\n        JButton btnAddExpense = new JButton(\"Add\");\r\n        btnAddExpense.addActionListener(new ActionListener() {\r\n            public void actionPerformed(ActionEvent e) {\r\n                addExpense(currentAccountId, dateField.getText(), descField.getText(),Double.valueOf(amountField.getText()) );\r\n                try {\r\n                    loadData((DefaultTableModel)table.getModel(), currentAccountId);\r\n                } catch (SQLException e1) {\r\n                    \/\/ TODO Auto-generated catch block\r\n                    e1.printStackTrace();\r\n                }\r\n            }\r\n        });\r\n        btnAddExpense.setBounds(239, 39, 117, 25);\r\n        bottomPanel.add(btnAddExpense);\r\n        \r\n        JLabel lblTotalExpense = new JLabel(\"Total Expense : \");\r\n        lblTotalExpense.setBounds(22, 75, 120, 15);\r\n        bottomPanel.add(lblTotalExpense);\r\n        \r\n        JLabel lbltotalAmount = new JLabel(\"--\");\r\n        lbltotalAmount.setBounds(143, 75, 70, 15);\r\n        bottomPanel.add(lbltotalAmount);\r\n        \r\n        JLabel lblCurrAcc = new JLabel(\"Current Acc Name:\");\r\n        lblCurrAcc.setBounds(270, 76, 130, 15);\r\n        bottomPanel.add(lblCurrAcc);\r\n        \r\n        JLabel lblAccountName = new JLabel(\"Account Name\");\r\n        lblAccountName.setBounds(412, 76, 130, 15);\r\n        bottomPanel.add(lblAccountName);\r\n        \r\n        btnSelect.addActionListener(new ActionListener() {\r\n            public void actionPerformed(ActionEvent e) {\r\n                String accountId = (String)accBox.getSelectedItem();\r\n                accountId = accountId.substring(0, accountId.indexOf('|'));\r\n                currentAccountId = Integer.valueOf(accountId);\r\n                try {\r\n                    loadData((DefaultTableModel)table.getModel(), currentAccountId);\r\n                } catch (NumberFormatException e1) {\r\n                    \/\/ TODO Auto-generated catch block\r\n                    e1.printStackTrace();\r\n                } catch (SQLException e1) {\r\n                    \/\/ TODO Auto-generated catch block\r\n                    e1.printStackTrace();\r\n                }\r\n                String details[] = getAccountDetails(currentAccountId);\r\n                lbltotalAmount.setText(details[1]);\r\n                lblAccountName.setText(details[0]);\r\n            }\r\n            \r\n        });\r\n        \r\n        try {\r\n            updateCombox(accBox);\r\n        } catch (SQLException e1) {\r\n            \/\/ TODO Auto-generated catch block\r\n            e1.printStackTrace();\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<ul>\n<li><strong>initDB():<\/strong> This function initializes the database and creates two tables, &#8220;accounts&#8221; and &#8220;expenses,&#8221; if they don&#8217;t exist. It uses SQLite as the database engine.<\/li>\n<li><strong>addAccount(String accountName):<\/strong> This function adds an account to the database. It takes the account name as input and inserts it into the &#8220;accounts&#8221; table.<\/li>\n<li><strong>loadData(DefaultTableModel model, int acId):<\/strong> This function loads expense data from the database into the JTable component. It clears the existing table data, retrieves expense data for the specified account ID, and populates the table using a DefaultTableModel.<\/li>\n<li><strong>getAccountDetails(int accountId):<\/strong> This function retrieves account details such as account name and total expense amount from the database. It executes SQL queries to fetch the required data and returns the details as an array.<\/li>\n<li><strong>addExpense(int accountId, String date, String description, double amount):<\/strong> This function adds an expense to the currently selected account. It takes the account ID, date, description, and amount as input and inserts them into the &#8220;expenses&#8221; table.<\/li>\n<li><strong>updateCombox(JComboBox&lt;String&gt; cbx):<\/strong> This function updates the JComboBox component with account data from the database. It clears the existing items and retrieves account data from the &#8220;accounts&#8221; table, adding them as items to the combo box.<\/li>\n<li><strong>initialize():<\/strong> This function initializes the GUI components of the Expense Tracker application. It sets up the frame, panels, labels, text fields, table, and buttons, along with their respective event listeners.<\/li>\n<\/ul>\n<p>These functions work together to provide functionality for adding accounts, selecting accounts, adding expenses, and displaying account details and expense data in the GUI.<\/p>\n<p><strong>Java Expense Tracker Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker-personal-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-115636 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker-personal-output.webp\" alt=\"expense tracker personal output\" width=\"620\" height=\"418\" \/><\/a><\/p>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker-travel-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-115637 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker-travel-output.webp\" alt=\"expense tracker travel output\" width=\"620\" height=\"418\" \/><\/a><\/h3>\n<h3><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-115638 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker-output.webp\" alt=\"expense tracker output\" width=\"612\" height=\"403\" \/><\/a><\/h3>\n<h3>Summary:<\/h3>\n<p>In summary, We have created an Expense tracker application using Java and SQLite.<\/p>\n<p>We got a basic understanding of how we can create an application that can manage our expenses and provide us with different accounts and the total expenditure of each account. We also added the functionality to add expenses with the description and date for reference.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2620,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1u2e3cNlf9qBg2Amp206RywnxPgxTX6Qi\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601085451\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1u2e3cNlf9qBg2Amp206RywnxPgxTX6Qi\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 08:40:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-06 19:42:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-10 19:24:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-14 15:52:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-18 12:23:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-22 12:50:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-26 07:34:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-30 10:41:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-03 18:23:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-07 07:43:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-11 05:29:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-07-16 04:55:03&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-16 04:55:03&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, we will be creating an application that can track our expenses. The application will have multiple accounts option so that the user can track their expenses more efficiently. The user can&#46;&#46;&#46;<\/p>\n","protected":false},"author":581,"featured_media":115635,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[24832,27720,27721,27719,27229,22416,22417],"class_list":["post-115130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-expense-tracker","tag-expense-tracker-project","tag-java-expense-tracker","tag-java-expense-tracker-project","tag-java-project-for-practice","tag-java-project-ideas","tag-java-projects"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Expense Tracker \u2013 Your Personal Finance Manager - DataFlair<\/title>\n<meta name=\"description\" content=\"Get your finances in order and achieve your goals with Java Expense Tracker. Track spending, manage budgets, and take control of your money.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Expense Tracker \u2013 Your Personal Finance Manager - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Get your finances in order and achieve your goals with Java Expense Tracker. Track spending, manage budgets, and take control of your money.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-22T23:30:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T08:54:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Expense Tracker \u2013 Your Personal Finance Manager - DataFlair","description":"Get your finances in order and achieve your goals with Java Expense Tracker. Track spending, manage budgets, and take control of your money.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/","og_locale":"en_US","og_type":"article","og_title":"Java Expense Tracker \u2013 Your Personal Finance Manager - DataFlair","og_description":"Get your finances in order and achieve your goals with Java Expense Tracker. Track spending, manage budgets, and take control of your money.","og_url":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-06-22T23:30:04+00:00","article_modified_time":"2026-06-01T08:54:13+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445"},"headline":"Java Expense Tracker \u2013 Your Personal Finance Manager","datePublished":"2023-06-22T23:30:04+00:00","dateModified":"2026-06-01T08:54:13+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/"},"wordCount":606,"commentCount":6,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker.webp","keywords":["expense tracker","expense tracker project","java expense tracker","java expense tracker project","java project for practice","java project ideas","java projects"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/","url":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/","name":"Java Expense Tracker \u2013 Your Personal Finance Manager - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker.webp","datePublished":"2023-06-22T23:30:04+00:00","dateModified":"2026-06-01T08:54:13+00:00","description":"Get your finances in order and achieve your goals with Java Expense Tracker. Track spending, manage budgets, and take control of your money.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/java-expense-tracker\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/06\/expense-tracker.webp","width":1200,"height":628,"caption":"expense tracker"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/java-expense-tracker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"Java Expense Tracker \u2013 Your Personal Finance Manager"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam6\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/115130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=115130"}],"version-history":[{"count":8,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/115130\/revisions"}],"predecessor-version":[{"id":148706,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/115130\/revisions\/148706"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/115635"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=115130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=115130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=115130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}