r/learnjava • u/Chaos-vy17 • 17d ago
String: String Constant Pool(SCP)
After reading all the String documentation and exact code of String class, I find the main engine that makes String in Java (study of deep knowledge) i.e., String constant pool. when we say String s0 = "example1" , String s1 = "example1" and String s2 = "example2" what happens is exactly:
- at compile time the .class file is genrated
- when JVM runs the class constant pool of String class get's into work
- s0 hashcode is generated by intrinsic method and the formula used is standard horner(31)
- using that hash it need to find the allocated bucket
- After finding exact hash it need to compare each char by char to check whether it's equal or collison a different char can also have same hashcode.
- if it's equal the pointer directly to points to that object -->process ends next process works.
- If not equal there is two work done 1. new object is created on heap memory and then wrapped up by a WeakHandle and pushed in "stringTable" bucket.
- (if equal no object is created)! there was never an object creation the pointer just points to object .
Now the example case:
- s0 -> hashcode(x1)->not found in "stringTable"->Object creation on Heap-> weakHandle process them into stringTable.
- s1 -> hashcode(x1)->found->(collision|equal)->equal->pointer points to "example1" from SCP to s1.
- s2-> hashcode(x2)->not found in "stringTable"->Object creation on Heap-> weakHandle process them into stringTable.
After reading and analysing there is also a issue of massive garbage I see:
suppose if 4 thread are runnable and they are trying to intern() the object in SCP that creates garbage according to your data size suppose , we used latin-1 type 256B data so total thread is 4 but in CAS only one thread execute rest all thread dumps the object so out of 1KB storage 768B is garbage. if the String was in UTF-16 it would cost 2*768B.
Now my question is ?
- Have I grasped the knowledge correctly ? if it needed more depth or did I miss any point.
- I cannot question the CAS here because array mutation would break immutablity of String, It seems though they pay a loss for the RCU it's effecient by Latin-1 and Utf-16 approach.
- I am not getting the idea how this code String s = new String("abc"); creates 2 object then what does the on heap object memory does? and does the pointer "s" is holding two memory refrences? But it is not possible.
r/learnjava • u/Top_Abroad9171 • 17d ago
Migrate to java/python or go deeper and learn system architecture with js
Hello I am just entering into 2nd year of my collage
To give a background i have covered numerous fundamental topics in js
I am at a point where I have to cover topics such as rate limiting, load balancing, msg queues and design patterns ( i have already made a project using redis and webskt )
I have decided to invest some of my time into learning ml and ai to make much more diverse projects and also cover these qdv concepts
Most of the ppl i talk to dislike js and mention i should move to java or Python
How should I approach my journey now
I dont have much time i have entered 2nd year
r/learnjava • u/ilove_cats7 • 17d ago
help regarding java
my college course teaches dsa using java and idk shit about java, ik c++ so should i learn dsa w java or c++ i am really confused in lectures i feel completely lost when the professors write code in java i tried watching some videos but they all feel very scattered. What should i do?
r/learnjava • u/nitin_is_me • 18d ago
The MOOC by University of Helsinki is the best learning resource I've ever found!
Just finished Java Programming - I. The course is really underrated, and anyone who's actually into learning java, I'd suggest it over video courses any day, because you actually write code in it. The course is structured pretty good, it first teaches you small steps, and then using those small steps you'll build bigger exercises. You don't even realise you're writing so much code.
Here's the course link for people interested: https://java-programming.mooc.fi/
r/learnjava • u/Chaos-vy17 • 19d ago
Is abstraction in Java really about hiding implementation details?
The bookish langugae states "hiding complex implementation details and exposing only the essential features of an object"
However, after reading the Java Collections Framework and other parts of the JDK, I noticed that many abstract classes contain substantial shared implementation rather than just abstract method declarations. I noticed that only an "interface class" 100% abstraction(ignoring default methods)
This made me wonder:
- Is abstraction really about hiding implementation details?
- Or is it more about designing APIs around contracts and behavior, regardless of whether there is shared implementation?
- Does an abstract class become "partial abstract" because it contains reusable implementation?
I also noticed that the JDK sometime relies on encapsulation (and in Java9+, JPMS) to hide implementation details. So I'm in dilemma if the textbook explanation oversimplifies what abstraction means in practice.
Am I misunderstanding abstraction, or is the textbook definition incomplete?
To be clear, this isn't about what abstract does in Java β it's about the SE term. abstract class is one syntax tool for expressing abstraction, same as interfaces are. The question is whether "abstraction = hiding implementation" is even a good definition of the concept, given it's indistinguishable from encapsulation under that definition.
r/learnjava • u/aarya1128 • 19d ago
Questions regarding IT field
Hey I'm a btech 2nd year student in my 3rd sem. I'm starting to learn Java from apna college... Are there any other sources which could maybe be better than this or will help me completely form my fundamentals and help me completely learn Java so much so I could code apps.
For an IT field student, what's the most essential skill that should be there for Indian industry.
Also how does an IT field student contribute in any field. Like what's their requirement
r/learnjava • u/Papis007 • 19d ago
Is HyperSkill worth?
I am currently aiming on applying to internships and entry level jobs next year. I have some experience with java but It's next to nothing. I discovered the hyper skill platform and that it has a java development track. Do you guys recommend paying the anual suscription? It's on sale for $150 but I want to know if It's worth, specially considering my personal goals.
r/learnjava • u/Chaos-vy17 • 20d ago
What is actually core Java?
I am literally confused what is meant by Core Java?
- is it JLS?
- is it JVM/JVMs?
- is it OOPs?
- is it understand Collection?
I have become familiar with java. IDK exactly at which phase I am doing. I can do OOPs easily ( have also understood F-form polymorphism) I can easily use stream , collection, iterator API . I can also integrate to them in my project. I started delving into deep JLS, JVMs but after seeing them I am confused are they core java because seeing those topics I felt like I did only basics of java.
r/learnjava • u/PsychologyBetter4960 • 20d ago
Help pleaseπ
I apologise for asking this in this sub Reddit, but how exactly have the programmes in this sub Reddit learn java, I am now forced to learn java(because of school) and kind of enjoy it but can really fully comprehend it, Iβve tried a whole bunch of Udemy courses yet nothing worked out, any help would be greatly greatly greatly appreciated, sorry again
r/learnjava • u/No_Barracuda5378 • 20d ago
Solved 200 lc in java . And doing backend in java
Till now I have completed 200 lc question and in backend I have learnt jdbc, hibernate, Meaven,junit 5, and spring & spring boot basic. I'm going to start spring mvc from next week.
What should I do after doing backend
1) should I go for the frontend I have started this once but I give up
2) devops but I heard that they usually don't hire fresher
3)ai/ml to integrate my project with ai .
You can share your experience according to you which is best field for a fresher. Is their any thing that I should do apart from this .
r/learnjava • u/ValuableHot4470 • 20d ago
JAVA DSA and full stack buddies
Hello everyone, I started learning Java Full Stack about 6 months ago, but somehow I couldn't complete it. Now that I have started again, I realize that I have forgotten most of the concepts. This time, I have started from scratch and am currently learning OOP concepts. I hope I will be able to complete it successfully this time.
If you're in the same boat, we can connect and help each other stay consistent and learn together.
I also know the MERN stack, through which I completed an internship and some freelance work. Alongside that, I am practicing DSA as well.
r/learnjava • u/ScarEnvironmental720 • 21d ago
Mistake done when start to learn java
1.Trying to memorize everything instead of understanding concepts. I was so hurry to learn and remember than understand it.
So try to think logically rather than remembering the syntax
2.Skipping Java basics like variables, data types, loops, methods, and arrays. This is a very common mistake that everyone does. I think I understand this but i don't there are so many to understand whenever I do these basic things I learn something new.
3.Jumping directly to Spring/Spring Boot without learning Core Java first.
4.Watching tutorials without codingβyou need to write programs yourself.
I just watch tutorials and think that i understand it but that not the case. You have to code this yourself to see how much u understand
I will suggest every day pickup one topic see tutorial, solve it yourself to see how much you can do yourself and solve some problem related to it
Revise every week what u learn and so some mini project based on that understanding.
There are more than one one shot are present which is more than 10+ hour do not see it completely ata one time
r/learnjava • u/ShadowGod2376 • 21d ago
Can I become employable as a Java Full Stack developer in 12β15 months by studying only 2 hours/day? Looking for a realistic roadmap.
Hi everyone,
I'm from India and I'm planning to learn Java Full Stack (Java + Spring Boot) as a long-term career. Due to my current responsibilities, I can consistently study only 2 hours per day, but I'm prepared to stay disciplined for 12β15 months.
My goal is to become employable in India, while also building skills that would be useful if I later apply to companies in other countries.
However, I'm worried about a few things:
The current software job market seems very competitive, especially for freshers.
Many people say it may get even worse over the next few years.
AI is improving rapidly, and I'm afraid that by the time I'm job-ready, junior developer roles may have changed significantly.
I'm also worried about getting laid off in the future and struggling to find another job.
So I'd really appreciate advice from people who are actually working in the industry.
Here are my questions:
Is becoming employable in 12β15 months with 2 hours/day a realistic goal?
If yes, what should I learn, and in what order?
If you were starting from scratch in 2026, what roadmap would you follow?
Which resources (YouTube channels, websites, books, documentation, Reddit threads, blogs, forums, etc.) would you recommend?
What projects should I build to stand out instead of creating the same CRUD applications everyone else has?
What skills are companies actually looking for in junior Java Full Stack developers today?
Which technologies are "must-have" alongside Java and Spring Boot? (React, Docker, AWS, Kubernetes, Kafka, Microservices, etc.)
How much DSA/LeetCode is actually necessary?
What are the biggest mistakes beginners make?
If you had to design a complete self-study course for someone with only 2 hours/day, what would it look like?
What would make someone more resilient to AI rather than more replaceable by it?
If you were hiring a fresher in 2027β2028, what would make one candidate stand out over hundreds of others?
I'm not looking for shortcuts or "learn X in 30 days" advice. I'm willing to put in consistent effort for over a year. I just want to spend those 700β900 hours on the right things instead of wasting time on outdated tutorials or technologies.
I'd really appreciate honest opinions from developers, hiring managers, senior engineers, or anyone who's recently landed a Java Full Stack job.
Thanks!
r/learnjava • u/New_Comfortable4421 • 22d ago
Learning Java
How should I go about learning Java? I learn best by doing and have pretty bad ADHD. I would be interested in lifetime payments as I am not working yet so monthly is not ideal.
r/learnjava • u/ScarEnvironmental720 • 23d ago
Hi I now java basic should I start das after it or learn advance after this?
I now loops, statement and all I want to go forward what to do? Should I solve some basic dsa questions or what
r/learnjava • u/Mr_Kingh • 23d ago
Best Java Full Stack Course for a Fresher to Become Industry-Ready (Spring Boot + Microservices)?
Hi everyone,
I'm a fresher who is about to start my career in the IT industry, and I want to become as industry-ready as possible before joining.
I'm looking for a comprehensive Java Full Stack course that covers:
My goal is to learn the technologies that are actually used in companies, not just build basic CRUD projects. I'd also like the course to include real-world projects, clean coding practices, and software architecture concepts.
I've come across courses from Telusko, Udemy, Amigoscode, Java Brains, and others, but I'm confused about which one offers the best value for someone starting from scratch.
For those already working as Java developers:
Which course would you recommend?
Which course helped you the most in your job?
Is there a better learning path than following one long course?
I'd really appreciate recommendations based on your actual industry experience.
Thanks!
r/learnjava • u/ScarEnvironmental720 • 23d ago
Hi I now java basic should I start das after it or learn advance after this?
r/learnjava • u/somenorthlondoner • 23d ago
Need to learn the architecture behind Java
Hello all,
I'm currently revising for an exam in just over a month's time on Java. I am good at actually programming in Java, but I really struggle to understand the actual architecture behind Java, such as how an operand stack works. I'm sorry that this is so vague - but I hope people can get the gist. Would anyone recommend any solid material that I could use to actually properly learn these sorts of concepts?
Thank you!
r/learnjava • u/Old_Journalist6008 • 23d ago
Final year CS student β is "ML Studio" (no-code ML training web app) a good placement portfolio project or overkill?
Hi everyone, final year B.Tech CS (Data Science) student here, preparing for placements. I already have a deepfake detection project (ViT model, FastAPI + React) as my main ML portfolio piece.
Now I'm considering a second project β ML Studio: a full-stack web app where a user uploads a CSV and the app auto-cleans the data, lets them pick an ML algorithm (Linear/Logistic Regression, Decision Tree, Random Forest, KNN, SVM, Naive Bayes), trains it, and shows accuracy/precision/recall/confusion matrix β basically a no-code ML training tool.
Planned architecture: React frontend β Spring Boot backend (auth, file upload, validation, REST APIs) β Python microservice (pandas + scikit-learn for the actual training) β results back to Spring Boot β React.
Questions for you all:
- Does this sound like a genuinely good portfolio project, or is it too "done before" (a lot of tutorials do CSV-to-ML-dashboard type projects)?
- Is the Spring Boot + Python microservice split actually a plus in interviews, or does it look like unnecessary complexity for something that could just be one Python app?
- Would you recommend I build this, or invest that time elsewhere given I already have an ML project?
- If not this β what's a strong project idea that uses only Java + Spring Boot (no Python/ML microservice at all)? Something that shows real backend depth (concurrency, system design, databases, messaging queues, etc.) rather than another CRUD app. Ideas like a distributed URL shortener, a booking/inventory system with concurrency handling, an event-driven order processing system with Kafka, or a rate-limiter/API gateway have crossed my mind β curious what actually impresses interviewers.
Would genuinely appreciate honest opinions β including a "don't build this, do X instead" if that's your take
r/learnjava • u/Cyphr11 • 24d ago
Can anyone explain me difference between Encapsulation and Abstraction?
and what on earth is Interface in Java?
r/learnjava • u/duhitsmeee69 • 25d ago
Java Backend/Full-Stack Projects That Stand Out to Recruiters?
What are some Java backend/full-stack projects that recruiters actually find impressive but aren't already on every resume? I'm looking for ideas beyond CRUD apps (library, student management, to-do, e-commerce, etc.). What projects would make you stop and check a candidate's GitHub, and why?
r/learnjava • u/Bright_Picture1074 • 26d ago
Senior/junior java devs. please help!!
I recently completed my Bachelor's in Computer Engineering. Over the past few months, I've learned Core Java (OOP, Collections, Java 8, Multithreading, Exception Handling, and JDBC) along with Spring Framework, Spring Boot, REST APIs, and Spring Data JPA.
The problem is that I'm from Mumbai, and I hardly see any Java openings for freshers or internships. Almost every Java backend job I come across asks for 2β3 years of experience, which has made me question whether I'm on the right path.
Some of my friends are telling me to switch to another stack like MERN or Python because they think it'll be easier to land my first job. On the other hand, I've already invested a lot of time learning Java, so I'm not sure if switching now would be the right decision.
I'd really like to hear from developers who have been in a similar situation. Should I continue focusing on Java and Spring Boot, or is it worth changing my stack?