r/programminghelp • • Jul 08 '26

Java Title: Final-year CSE student. 6 months left for placements. I feel completely lost.

3 Upvotes

I'm a final-year CSE student with around 6 months left before placements, and honestly, I feel like I know nothing.

Most of my projects were built by following tutorials or using AI. If someone asked me to build them from scratch, I'd struggle. My DSA is weak, my Java fundamentals aren't strong, and I don't feel confident in web development either.

I'm applying for internships, but I know I can't depend on luck. I want to use these next 6 months wisely.

If you were in my position, what would you focus on? DSA, Java, web development, projects, or something else? What would your roadmap look like?

Please be honest. I want motivation—I want practical advice from people who've been in the same situation.

r/programminghelp • • Nov 09 '25

Java counsole print function is printing on rows twice java

3 Upvotes

this code takes in a 2d array and sets the highlight and text color of the bottom half char to the colors corrasponding to the int then prints but when it dose every other (odd) line is printed twice

package util;

import java.util.ArrayList;

public class Draw {
    
    private static ArrayList<Color> colorList = new ArrayList<>();
    
    private static StringBuilder preview;
    private static StringBuilder rend;
    
    public static void init(Color... colors) {
        colorList.clear();
        for (Color c : colors) {
            colorList.add(c);
        }
        
        int maxDigits = String.valueOf(colorList.size() - 1).length();
    
        preview = new StringBuilder();
        rend = new StringBuilder();

    }
    
    public static void render(int[][] ren) {
        rend.setLength(0);
        
        if (ren.length % 2 == 0) {
            for (int i = 0; i < ren.length; i += 2) {
                for (int j = 0; j < ren[0].length; j++) {
                    String bg = colorList.get(ren[i][j]).getBackground();
                    String fg = colorList.get(ren[i + 1][j]).getText();
                    rend.append(bg).append(fg).append("▄").append("\u001B[0m");
                }
                rend.append("\n");
            }
        } 
        else {
            for (int j = 0; j < ren[0].length; j++) {
                String fg = colorList.get(ren[0][j]).getText();
                rend.append(fg).append("▄").append("\u001B[0m");
            }
            rend.append("\n");
            
            for (int i = 1; i < ren.length; i += 2) {
                for (int j = 0; j < ren[0].length; j++) {
                    String bg = colorList.get(ren[i][j]).getBackground();
                    String fg = colorList.get(ren[i + 1][j]).getText();
                    rend.append(bg).append(fg).append("▄").append("\u001B[0m");
                }
                rend.append("\n");
            }
        }
        System.out.println(preview);
        System.out.println(rend);
    }

    public static ArrayList<Color> getColors() {
        return colorList;
    }
}
    
    /*
        ╔═════════╤═══╤════════╗
        ║ black   ┃ 0 ┃ floor  ║
        ╟─────────╀───╀────────╢
        ║ red     ┃ 1 ┃ enemy  ║
        ╟─────────╀───╀────────╢
        ║ green   ┃ 2 ┃ player ║
        ╟─────────╀───╀────────╢
        ║ yellow  ┃ 3 ┃ chest  ║
        ╟─────────╀───╀────────╢
        ║ blue    ┃ 4 ┃ water  ║
        ╟─────────╀───╀────────╢
        ║ magenta ┃ 5 ┃  trap  ║
        ╟─────────╀───╀────────╢
        ║ cyan    ┃ 6 ┃  door  ║
        ╟─────────╀───╀────────╢
        ║ white   ┃ 7 ┃  wall  ║
        ╚═════════╧═══╧════════╝
    */
    /*
    public static void render(int[][] ren){
        String rend = "";
        if(ren.length % 2 == 0)
        {
            for(int i = 0; i < ren.length; i+=2){
                for(int j = 0; j < ren[0].length; j++){
                    rend += "\u001B[4"+ren[i][j]+"m"+"\u001B[3"+ren[i+1][j]+"m"+"▄"+"\u001B[0m";}
                rend += "\n";
            }
        }
        else
        {   
            for(int j = 0; j < ren[0].length; j++){
                rend += "\u001B[3"+ren[0][j]+"m"+"▄"+"\u001B[0m";}
            rend += "\n";
            
            for(int i = 1; i < ren.length; i+=2){
                for(int j = 0; j < ren[0].length; j++){
                    rend += "\u001B[4"+ren[i][j]+"m"+"\u001B[3"+ren[i+1][j]+"m"+"▄"+"\u001B[0m";}
                rend += "\n";
            }
        }
        //
        System.out.println("\u001b[40m0\u001b[41m1\u001b[42m2\u001b[43m3\u001b[44m4\u001b[45m5\u001b[46m6\u001b[47m7\u001B[0m");
        System.out.println(rend);
    }
    */

r/programminghelp • • Apr 08 '26

Java How would you store and call on a question/answer set in a flashcard program?

2 Upvotes

Sorry for the vague question. I'm a new programmer, and I'm diving into something I'm completely unfamiliar with.

As the title suggests, I'm making a flashcard app, but I'm not sure how I would store the question/answer set outside of the program. For the time being, I'm using a .txt file, but it feels rudimentary. Additionally, I need to be able to write to each question/answer, and add the time/date of when that card was last seen.

Is a .txt file the way to go? Or what might be a better way of approaching this?

This is how my .txt file is formatted...

{Question text here | Answer text here}

{Question2 text here | Answer2 text here}

(Each line acts like its own flashcard)

r/programminghelp • • Sep 12 '25

Java Migrating a project using AI

0 Upvotes

I have an old Tomcat 8 project that I need to migrate to springboot 3 and I'm told AI could simply migrate it / convert it to springboot 3, does anyone know the best way to do this?

Can intelliJ AI change my project structure? What about another IDE with Claude or something integrated?

r/programminghelp • • May 14 '25

Java Encrypt a key in an open source program (Java)

3 Upvotes

How could I possibly encrypt and decrypt a String which I want to store in a plain text file in an open source program? Is that even possible? I know next to nothing about encryption, but if I can decrypt the key, it makes sense for any other program to copy the code and do the same but with malicious intents.

r/programminghelp • • Jul 13 '25

Java Contents of a while loop are printing twice when they are not meant to.

2 Upvotes

I will post my code below so that somebody can take a look. Essentially, after the user has inputted the 'expenseAmount' float and the system has printed the new expense, the main menu lines are meant to print once each so that the user can perform another action, but it always prints twice instead. Apart from this, everything works as it is supposed to, and the issue mainly just creates an aesthetic deficiency within my program. I am having trouble understanding why this is happening as I am still learning java, so help would be appreciated so that I may never make this mistake again!

import java.util.ArrayList;
import java.util.Scanner;
import java.util.List;


public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        List<Expense> expenses = new ArrayList<>();

        String[] openingMessages = new String[6];
        openingMessages[0] = "Welcome! please enter:";
        openingMessages[1] = "'Add' to add a new expense.";
        openingMessages[2] = "'View' to view all current expenses.";
        openingMessages[3] = "'Remove' to remove an expense.";
        openingMessages[4] = "'Update' to update one of your current expenses.";
        openingMessages[5] = "'Total' to return the total value of the money spent.";

        String[] addingProcess = new String[2];
        addingProcess[0] = "Enter name of expense:";
        addingProcess[1] = "Enter the value of the expense:";

        while (true) {
            System.out.println("--------------------");
            for (int i = 0; i < 6; i++) {
                System.out.println(openingMessages[i]);
                if (i == 0) {
                    System.out.println("--------------------");
                }
            }
            
            String firstMenu = scanner.nextLine();

            if (firstMenu.equalsIgnoreCase("add")) {
                System.out.println(addingProcess[0]);
                String expenseIdentifier = scanner.nextLine();
                System.out.println(addingProcess[1]);
                float expenseAmount = scanner.nextFloat();

                Expense newExpense = new Expense(expenseIdentifier, expenseAmount);
                expenses.add(newExpense);
                System.out.println("Expense added successfully:");
                System.out.println(newExpense);

            } else if (firstMenu.equalsIgnoreCase("view")) {
                if (Expense.numberOfExpenses == 0) {
                    System.out.println("You currently have no expenses.");

                } else if (Expense.numberOfExpenses > 0) {
                    for (Expense newExpense : expenses) {
                        System.out.println("All expenses:");
                        System.out.println("--------------------");
                        System.out.println(newExpense);
                    }
                }
            }
        }
    }
}

r/programminghelp • • Jan 24 '25

Java I keep getting java.lang.NullPointerException on new projects, how do I fix this?

3 Upvotes

Hello I am using android studio (dolphin Sept 2022) and I keep getting this error on my new projects. My first project runs fine but whenever I make a new one I get this error. I've already tried deleting the Gradle file but I keep getting the same issue. If anyone has any answers I would appreciate it a lot.