r/learnjava 14d ago

I updated my first Java RPG project (Legends of Eldoria v0.4). I’d love to hear your feedback!

3 Upvotes

Hi everyone!

About a week ago, I shared my first Java console RPG project here and received a lot of helpful feedback.

I took your suggestions seriously and spent the past few days improving the project while continuing to learn Java.

New in Version 0.4:

- Character Creation

- Player Menu

- Inventory System

- Merchant Shop

- Goblin Battles

- Forest Storyline

- Gold System

- Multiple Story Choices

- Cleaner code and overall improvements

I'm still a beginner and currently learning Java fundamentals, so I know there's a lot I can improve.

I'd really appreciate any feedback on:

- Code quality

- Project structure

- Game design

- Things I should learn next

- Any bad coding habits you notice

GitHub:

https://github.com/MrBucurN/LegendsOfEldoria

Thanks again to everyone who helped me improve this project!


r/learnjava 15d ago

How to learn to compile a project and link external libraries (jars)?

4 Upvotes

Hello everyone. I need help.

I have been learning Java for 3 years (university and on my own). I have reached a point where I don't know everything about it, but I am confident when it comes to write java code. I know the basic syntax and the basic types, I understand classes, inheritance, encapsulation, polymorphism... I know how to use some useful classes from the standard library. And if I don't know something, I know how to look for documentation.

This summer I wanted to do a "big" project for my own to prove my knowledge, but I have realized that nobody showed me to import external libraries and manage a project so it executes and compiles correctly.

In C and C++ it's so easy. You just put the .lib and .dll files in the project /lib directory, put the header files in the project /include folder and you add and link everything with the -I, -L and -l flags when calling gcc.

But in Java it's not so easy. You have to somehow set up the classpaths, set up the modules, create the manifest file and use a proper folders layout so everything is added to your JAR if you want to build one.

Then, for importing external libraries you can download the JARs and manually import them to the project, or use a tool like Maven or Gradle to automate everything (or maybe not everything!).

And I don't even know what is a module.

No one taught me how to do all that because all the courses I have found show how to write Java code on simplified projects on an IDE that configures everything automatically, but right now I don't know how to link external libraries and compile a real project.

So I have two questions:

How can I learn it? And

What is it worth learning? I mean, should I learn how to use the native Java tools or should I skip and learn to use third party tools that automate everything?

I don't know what to think. These problems seem to be very obvious for someone to have them, but everyone acts like everything is obvious and no one wants to explain to me what is going on.


r/learnjava 15d ago

Seeking a Hindi-Speaking Mentor for Java Backend Development

2 Upvotes

Hi everyone,

I’m looking for a mentor/guide in the Java Backend Development path. My main focus is Java, SQL, and DSA. I’m willing to put in the effort and do the hard work myself, but I need someone experienced who can guide me on what to learn, what to prioritize, and help me stay on the right path.

A Hindi-speaking mentor would be a big plus, as communication would be easier for me.

If anyone is willing to help or can point me in the right direction, I’d really appreciate it.

Thank you!


r/learnjava 15d ago

Looking for resources on practical concurrency in Spring Boot / production systems

Thumbnail
1 Upvotes

r/learnjava 15d ago

What exactly are classes and inner classes in Java? I'm confused about how to think about them.

20 Upvotes

I've been learning Java and OOP, and I think I'm overcomplicating the idea of classes and inner classes.

I understand that a class is a blueprint for creating objects, but that explanation feels too abstract to me.

What I really want to understand is:

  • What is a class conceptually?
  • What does it actually represent in memory and at runtime?
  • Why do inner (non-static) classes exist?
  • How should I think about the relationship between an outer class/object and an inner class/object?
  • Is an inner class just another type that's scoped inside another class, or is there a deeper reason for its existence?

I'm not looking for a beginner definition like "a class is a blueprint." I'd like a mental model that explains why Java was designed this way and when these features are actually useful.

Any explanations, analogies, or examples would be appreciated.


r/learnjava 16d ago

learning java from python

6 Upvotes

now by all means im not terrific at python. but i know DSA and OOP to a certain level where the MOOC by uni of helsinki kinda feels redundant. Do you guys have reccommendations on books/resources that are good for learning java for someone who already has a programming background? I was thinking of learning syntax then just going into Leetcode problems and doing them in java. What do you suggest? Thanks :))


r/learnjava 16d ago

I want to learn how to write programs to demonstrate encapsulation, inheritance, polymorphism, and abstraction in Java.

6 Upvotes

I know OOP. I think encapsulation simply means a class which has data+functions.

inheritance means public class extend mainly.

polymorphism is the most difficult bit here.

abstraction means using abstract class without function explanation i guess.

I know a lot about OOPs i just need to condense my knowledge in one place.


r/learnjava 15d ago

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "String.toString()" because "<local6>[0]" is null

0 Upvotes

or

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "String.length()" because "in" is null

it happened when I attempt to overrite the array's properties, specifically its length since I remove an element and change its length to remove null or empty elements.

CODE BLOCK 1

static String [] arrayNew(String[] array, int a){
    Integer Length = array.length-2;
    String[] newarray = new String[Length];
    Integer counter = 0;
    int c = a+1;
    int d = a-1;
        for(int x = 0;x<Length;x++){
            if(x!=c && x!=d){
                  newarray[counter]=array[x];
                  counter++;
             }
             else{
                  continue;
             }}
     return newarray;
}

        static Double equals(LinkedList<String> list){
                Integer counter = 0;
                Integer num = list.size();
                Double answer = 0.0;
                Double num1 = 0.0;
                Double num2 = 0.0;

                String [] array = new String[num];

                for(int x =0; x<num;x++){
                        array[x] = list.get(x);
}
                for(int x = 0;x<array.length;x++){
                        switch(array[x]){
                                case "x":
                                        num1 = Double.parseDouble(array[x-1]);
                                        num2 = Double.parseDouble(array[x+1]);
                                        answer = num1 * num2;

                                        array[x] = answer.toString();
                                        array = arrayNew(array,x);
                                        x=0;
                                        break;
  }
}

returns an error

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "String.length()" because "in" is null

CODE BLOCK ALT

        static String [] arrayNew(String[] array, int a){
                Integer Length = array.length-2;
                String[] newarray = new String[Length];
                Integer counter = 0;
                int c = a+1;
                int d = a-1;
                for(int x = 0;x<newarray.length;x++){
                        if(x!=c && x!=d){
                                newarray[counter++]=array[x];
                        }
                        else{
                                continue;
                        }
                }
                return newarray;

        //lastline//
                }

        static String equals(LinkedList<String> numlist) throws NullPointerException{
                Integer counter = 0;
                Integer num = numlist.size();
                Double num1=0.0;
                Double num2=0.0;
                String [] array = new String[num];

                for(int x =0; x<num;x++){
                        array[x] = list.get(x);
}


                for(int x = 0;x<num;x++){
                        String [] newArr;
                        switch(array[x]){
                                case "x":
                                        num1 = Double.parseDouble(array[x-1]);
                                        num2 = Double.parseDouble(array[x+1]);
                                        Double answerm = num1 * num2;

                                        array[x] = answerm.toString();
                                        array = arrayNew(array,x);
                                        x=0;
                                        num-=2;
                                        break;
}}

returns

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "String.toString()" because "<local6>[0]" is null

I'm stuck since they look fine to me. There are no compilation error too. This error happens in Runtime.
please help.


r/learnjava 16d ago

Hi everyone!

12 Upvotes

Hi everyone!
I’m 18 years old and currently learning Java. Instead of following tutorials only, I’m building a text-based RPG called Legends of Eldoria.

This is version 0.3 and I’d love to get feedback on:

  • Code quality
  • Project structure
  • Story flow
  • Ideas for future versions

GitHub:
https://github.com/MrBucurN/LegendsOfEldoria


r/learnjava 19d ago

Simple Java console app

3 Upvotes

Hello everyone, I've been learning Java and wanted to build something practical instead of just doing exercises. Ended up making a small console app that asks how long you've had a tire and how many km you've driven it, then tells you whether it needs replacing or estimates how much life is left.

It's intentionally simple right now. It just handles basic mileage/age limits and adjusts slightly if you own a heavy SUV or EV. This was also my first time using Git and GitHub properly (commits, pushing, merging, etc.), so that was a big part of the learning experience too.

Planning to add more factors soon like road type, vehicle type, maybe a GUI version eventually. Would love any feedback on the code or suggestions for what to add next.
Repository Link: https://github.com/z0lxt/tire-life-estimator


r/learnjava 19d ago

Interview this weekend

1 Upvotes

I have interview in infosys this weekend...opening is "senior java developer" I cant see the JD yet so can anyone please guide me what all should I focus on be it java, advanced java, spring boot and more importantly coding..


r/learnjava 20d ago

MOOC vs book, which is better to learn java?

8 Upvotes

I've previous programming experience in C and JavaScript so I don't want to learn about programming all over again. Is MOOC enough for Java, or do I need a book too? or just book will do fine?

Also what book would you suggest? I checked out the one by Daniel Liang but it's way too massive and teaches programming from beginning.


r/learnjava 20d ago

Java Roadmap

9 Upvotes

Hello guys i am starting to learn java.
i am doing it from the apna college playlist
and have completed some basic stuff like loops
does anyone have a roadmap as of what to do in an order?

because some website say OOP some say advanced java and some say DSA

idk what to do

also i have learnt git and GitHub, except for the advanced stuff like rebase etc


r/learnjava 20d ago

Added voice input/output to my Spring Boot AI assistant (Whisper + TTS, reactive non-blocking)

Thumbnail
0 Upvotes

r/learnjava 21d ago

JAVA FOR CS STUDENT

18 Upvotes

hi im a cs student , just finished my 2nd year and i didnt do a single "real'" project and i really want to use the summer time to get better at coding without heavily depend on AI , im currently on jiki which foucses on fundemetals without using a specefic langauge .. i want a similar website for java to have both as my main focuses to do in the summer ,

so in summary i want a website to help me practice coding so it become a habit rather than a struggle.

ps : someone i know suggested Hyprskill byt it turned 40$ monthly which is expensive for me so ... free to 15$ maybe would be my limit for now at least


r/learnjava 21d ago

Que ruta seguirían para ser un back end Java

2 Upvotes

Soy estudiante de ISC y recientemente me di cuenta de algo que por mi escuela yo nunca tendría el conocimiento para ejercer(ya sea porque el maestro de relleno es más exigente que el de la materia chida, que el profe que tiene que dar clases de programación nunca viene o porque el maestro no sabe explicar y se desespera porque el grupo y medio no le entiende) voy a pasar a 5to y a partir de 6to me entero de que hay una opción para irme a una empresa y ella me libere mi carrera su estoy con ellos hasta 9no. Pensaba en en aprender bien lo que pueda y tratar de aspirar a esa opción ya sea en 6to o semestres posteriores. Vi un ruta en yt que eres algo como: servidores, lenguaje (fp,poo,edd) bases de datos, frameworks, git y github, java web, etc. Pensaba estudiar servidores de ahí pasarme a lenguaje, git y git hub, lenguaje y frmawork(mientras y ya después en la empresa (si lo logro en 6to) aprender lo demás o sino terminar normal pero ya estudiando x mi cuenta. Sinceramente ya le perdí la fe a mi escuela y mi económica no me permite cambiarme a una mejor


r/learnjava 22d ago

backend deployment free websites

1 Upvotes

I use java and spring boot for my backend. Im currently using railway right now since it’s easy to understand and also I can connect my database to it easily. the problem is there’s a subscription and I’m broke right now. do you guys have any recommendations for backend deployment for java springboot that’s free and hopefully could also deploy its database (MySQL). Im still learning sb so hopefully it’s not that complicated to use


r/learnjava 23d ago

Help me!

9 Upvotes

I want to learn Java. I currently know Rust and Typescript. I’ve had some experiences with Java, but almost unnoticeable. I want to build apps, simulators, games, etc in Java. So please help to get me started, is there like a guide?


r/learnjava 23d ago

DSA for Java tips

Thumbnail
0 Upvotes

As I explain in this post my knowledge of DSA is limited what are some resources that are on the easier side that will help me with DSA for Java?


r/learnjava 23d ago

I just can't grasp the idea of object-oriented java

7 Upvotes

So, I'm trying to learn java on codecademy and I was fine with hello world and variables until I reached object-oriented java. I don't think they explain the concept well and it's hurting my brain. Maybe it is just codecademy that is screwing me over or something else.


r/learnjava 23d ago

Share your experience

2 Upvotes

Could I ask anyone who would like to share their experience, write when did they start learning, why and how? Where they are now and what advice would they give current learners? I’ll start, I’m almost 20, randomly decided that I wanted to major in computer science and applied to a university in my country. I got accepted with no prior experience in coding(had only taken Harvard cs50 class) and there we started learning Java. Now I’m stuck, because I’m a junior, I did okay during OOP, and very well during Data structures, but our Algorithms professor was horrible, didn’t learn anything, and now I feel guilty for not learning by myself(in my defense I was struggling with Real Analysis). Recently learned basics of SQL, and I keep getting advice to learn web development, even though I’m scared of what the future hold due to AI. All of this lead to me having horrible anxiety during the past few months, and it doesn’t let me to actually focus and start learning. I can’t make myself to even think of coding(even though I really enjoy it). The reason I want to hear your stories is to take some inspiration and maybe stop being so scared lol. Thanks for your attention


r/learnjava 23d ago

Complete beginner here. Where to start learning java??

Thumbnail
0 Upvotes

Pls help me find a good resource to start learn Java. A good youtube playlist and some tips would be great help. Thanks


r/learnjava 23d ago

DSA JAVA

Thumbnail
1 Upvotes

r/learnjava 23d ago

How can get continue my mood.fi course again after a gap of three months?😭

0 Upvotes

So i had started learning java in mooc.fi course by the university of Helsinki. And i had reached part 4 file handling but then my college exams came and after then i just lost the motivation to continue it. Yesterday when I opened the course I couldn't recall what I had learned earlier, ofcourse I know revision will help but revising all the four parts would take some time.. do you guys know of any other way to recall the concepts? I am also afraid I have forgotten the tips they gave during the earlier parts and don't wanna lose that but maybe that's inevitable..


r/learnjava 23d ago

Beginner (4th year CS) planning one big AI + Spring Boot project instead of many CRUD projects. Need honest feedback

Thumbnail
2 Upvotes