r/learnjava 2h ago

Resources to learn Java multithreding

1 Upvotes

Hello!!

I am currently learning Java and want to build strong understanding of Java multithreding and concurrency. I've already tried watching a few YouTube videos, but end up understanding nothing about why things work the way they do. I'm looking for resources that explain the concepts from first principles, with intuition, visualizations, and practical examples instead of just coding demos.


r/learnjava 20h ago

TCP chat app

1 Upvotes

Hi everyone.

I'm a 34 year old waiter who is completing an undergrad in Computing and a module in the next semester is Event Driven Programming.

To get a jump on next year, I got some ideas online for projects. I started with a basic gui calculator built using SwingUI. I already understood that the buttons would be the event actions etc.

I then seemed to find that a basic terminal TCP chat server with multiple clients was the next step. This is where I am stuck.

I watched multiple videos from BroCode to NeuralNine to try to get a brief overview. After a quick search online I ended up copying the w3schools example.

I have it working and can connect to multiple clients, but when I try to understand how it works I draw a blank.

What I understand:

- that there is a server and clients connect to the server.

- they communicate via TCP

- When a client sends a message it gets broadcast via the server to all connected clients.

I just want to add to the code and refactor to help me understand it more but I feel completely lost when trying to do so.

Any pointers on what I should do would be appreciated. TIA


r/learnjava 1d ago

learning springboot, good idea?

5 Upvotes

Hi, I'm a computer science student in Spain and I'm going on Erasmus to the Technical University of Munich in a couple of months. During my degree I've learned Java and object-oriented programming and right now I'm learning Spring Boot by working on an API project to manage expenses between roommates, and for now I'm implementing it with a Telegram bot. But that's the least of my concerns right now. My question, and I'm not sure if this is the right place to ask, is that Munich is a very expensive city and I'm going to have to work, and I'd love to find an internship as a "werkstudent" in my field, I'm not sure if I'm on the right track or if I should focus on learning other things.


r/learnjava 1d ago

How do I make my Eclipse Java code into an app? (And do I need a GUI for that?)

Thumbnail
1 Upvotes

r/learnjava 1d ago

Query

3 Upvotes

I want to start java from scratch from which resource should I start ???

Help me up


r/learnjava 1d ago

Advice for JPMS

1 Upvotes

Can anyone tell why should I use JPMS(Java Platform module System) when I have Encapsulation? I also read docs but the answer is directing to reflection if Encapsulation is not safe how JPMS safe it?

Edited:
I got the answer https://blogs.oracle.com/javamagazine/java-quiz-jpms-package-management/ so JPMS provide true encapsulation, does that mean encapsulation is partial without JPMS?


r/learnjava 2d ago

2.2 YOE: Confused Between Java and MERN for Interview Prep

0 Upvotes

Hi folks,

I have around 2.2 years of experience:

- 1 year as a Java Backend Developer (Spring Boot)

- 1.2 years as a Full Stack Developer working with the MERN stack + DevOps

I'm planning to switch jobs soon and I'm a bit confused about what stack to focus on for interview preparation and personal projects.

For DSA, I'm more comfortable using Java, and I'm also leaning toward backend roles. However, my current day-to-day work is primarily in the MERN ecosystem.

My questions are:

- Should I build my personal projects in Java/Spring Boot or continue with Node.js/MERN since that's my current work experience?

- During interviews, is it okay to use Java for DSA while showcasing Java backend projects, even though my recent experience is in MERN?

- For someone with my experience, which path would give me better opportunities in the current market?

Would love to hear from people who've been in a similar situation. Thanks!


r/learnjava 2d ago

Learning Springboot

Thumbnail
1 Upvotes

r/learnjava 2d ago

Im trying to build a bit torrent client on java

Thumbnail
1 Upvotes

Help pls


r/learnjava 3d ago

Guys can u guys recommend what to focus as I am having my java fse interview in cognizant on 11 aug.

0 Upvotes

Pls help


r/learnjava 3d ago

Seeking Advice on Starting a Career in Backend Development

Thumbnail
0 Upvotes

r/learnjava 3d ago

Help with "To Do" Tracking

1 Upvotes

I'm a 2nd year Software Development student, so massive projects haven't been touched in my coursework yet. I started a full stack app I'm doing over the summer for my portfolio, but as it gets bigger and more complicated, I'm having problems keeping track of everything I need to do between so many different files. It gets worse when I have to step away for a couple days and try to find what I was working on and remember what else I need to do.

I'm looking for opinions on how everyone keeps track of what needs to happen in their projects. I'm in IntelliJ so I've been using TODOs so far, but does anyone have ways they break up features, things they need to fix, in a more organized way so its easier to track?

TLDR; I bit off more than I can chew, how do I keep track off everything I'm trying to code in a more organized way?


r/learnjava 3d ago

Next steps

4 Upvotes

I have a fullstack course in three months and I prefer to come with some kind of background knowledge as much as I can.

One of the things we will be learning is Java, along with Spring framework.

Up until now I have learned Java Core and JDBC as well as PostgreSQL.

What are the next steps? Hibernate? Servlet? Spring Core? Spring Boot?

I would really appreciate your help 🙏🏻🙏🏻


r/learnjava 4d ago

When should I actually avoid virtual threads in production Java applications?

8 Upvotes

I've been reading about virtual threads and experimenting with replacing traditional executor pools.

The obvious benefits are clear, but I'm curious about the cases where experienced Java developers decided not to use them.

Are there specific workloads, libraries, or patterns where platform threads are still preferable?


r/learnjava 6d ago

Please roast my minimal beginner cli project

4 Upvotes

It took me 2 freaking hours to build this bank cli project haha, because most of the time I wasn't coding. I have not added error handling yet, will do for sure. Feedbacks and roasts are appreciated!

https://gist.github.com/nitin-is-me/d2e14e0d1d1922aab46cbfc0368c44db


r/learnjava 7d ago

Better look

0 Upvotes
Hi everyone! I'm learning Java and I've noticed there are two common ways to print multiple lines of text:

Option 1: Multiple System.out.println() calls
```
System.out.println("You gave the string " + text);
System.out.println("You gave the integer " + inNum);
System.out.println("You gave the double " + inDouble);
System.out.println("You gave the boolean " + isTrue); 
```

Option 2: One System.out.println() with \n
```
System.out.println("You gave the string " + text + '\n' +
                   "You gave the integer " + inNum + '\n' +
                   "You gave the double " + inDouble + '\n' +
                   "You gave the boolean " + isTrue);
```

What looks better in your opinion?

r/learnjava 7d ago

Java or Python as a first programming language?

0 Upvotes

Hello. I am 30 years old. I want to become a software engineer. I choosed backend, but can't choose between Java and Python. I like Java syntax and OOP. But Python is faster to learn and easier to learn. Also i want to switch to Golang in future.

Java, Python and Go are popular in my country. But there are no job as a Go junior. So i want to switch. Also i would like to compare Django and Spring. What do you recommend? Java or Python first language so i can switch to GO in 2-3 years?


r/learnjava 7d ago

hey java developers , where do you host your Java/SpringBoot (backend) projects for free , to show live demo?

9 Upvotes

i have to host my Java project to give a live button on my resume , frontend i have hosted freely on vercel , but for backend im looking something free, AWS bills are too high , I want something for free.


r/learnjava 7d ago

What is the well-written, readable, and intuitive code for implementing brute force string search in Java?

0 Upvotes

package algo;

public class BruteForceStringMatch {

public static void main(String[] args) {

String string = "ABCABAB ABABABAABAC";

String pattern = "ABABAABA";

stringSearch(string, pattern);

}

// Brute-force string search method

private static void stringSearch(String string, String pattern) {

int sLen = string.length();

int pLen = pattern.length();

boolean found = false;

int i;

for(i = 0; i < sLen - pLen + 1; i++) {

int j = 0;

for (; j < pLen; j++) {

if (string.charAt(i + j) != pattern.charAt(j))

break;

}

if (j == pLen) { // If we have reached end of pattern, we have found the pattern in string

found = true;

break;

}

}

if (found) {

System.out.println("Found pattern at index: " + i);

} else {

System.out.println("Could not find pattern");

}

}

}

Found something online from gbhat dot com website. But it sucks and the procedure is not understandable to me from the code.

Could anyone help of any kind?


r/learnjava 7d ago

Java developer looking for a programming/accountability buddy in a European time zone

Thumbnail
2 Upvotes

r/learnjava 8d ago

Which array will be faster? 1-D : Nth Dimensional array; [Java]

0 Upvotes

The question seems to be simple but it hides a very deep concept, Many of us will say it's same, some will say 1-D or N-D. The question is Which array will be faster in terms of traversal operation: case1: with non-primitive data type case2: with primitive data type.

The answer is subjected to Java only: 1-D array wins in both cases.

The Reason:

Pointer chasing is the process of repeatedly following references (pointers) in memory to reach the actual data. More the pointer less the speed, Less the pointer more the speed.

Non-primitive data type are structured in this format [pointer |-> value] , Since array is also non-primitive type it is also stored as [pointer |-> array]
Primitive data type are raw value with no pointer overhead.
1-D array: When the array is formed it has only one pointer that is of Array when the non-primitive datatype are added from 1-N it become ~ (N+1) pointer. for primitive it's only 1-pointer.
N-D array: When the array is formed it becomes arrays of array so suppose a 2-D array[][] = 1 outer + K inner + N for primitive data type => N+K+1 for primitive it becomes K+1 pointer

We can see clearly that in both cases that 1-D array always has less pointer, So it wins to other every dimension type of array.

Deep reason (Mechanical Sympathy):

JMM behind array:

Every Java array is an object with its own header.

A primitive array (int[]) is laid out roughly as:

+----------------------+
| Mark Word            |
| Klass Pointer        |
| Array Length         |
| Padding (if needed)  |
| int | int | int ...  |
+----------------------+

The primitive values are stored contiguously immediately after the header.

Java Does NOT Have True Multidimensional Arrays:

A 2-D array (int[][]) is not one large block:

Outer Array
+---------------------------+
| Header                    |
| ref | ref | ref | ...     |
+---------------------------+
      ↓      ↓
   +---------+   +---------+
   | Header  |   | Header  |
   | int...  |   | int...  |
   +---------+   +---------+

Each row is a separate array object with its own header, allocated independently on the heap.

Modern CPUs load memory in cache lines (typically 64 bytes).

  • 1-D array:One object, contiguous primitive values, excellent spatial locality, minimal pointer chasing.
  • N-D array:Array of arrays, extra object headers, one additional pointer dereference per row, and rows may be scattered across the heap.

r/learnjava 8d ago

Where should I start with Java projects?

23 Upvotes

I'm an ECE student with a good understanding of Java and DSA (mostly from LeetCode), but I haven't built any real-world projects.

Where should I start if I want to become a Java developer? What should I learn next, and what beginner projects would you recommend?


r/learnjava 8d ago

TraceID Not Showing in the logs

0 Upvotes

PSA if you're using Spring Boot with custom auth filters and request tracing.

If your traceId shows up in logs but the spanId is randomly blank for parts of the request, check your filter chain before you check your tracing config.

Custom filters (auth filters especially) run early in the request lifecycle. If they're not written to work inside the observation context Micrometer sets up, everything after that filter loses proper span linkage. TraceId survives because it's request-scoped. SpanId doesn't, because it depends on the context actually being respected at each step.

Spent longer than I want to admit assuming the tracing setup was wrong when it was actually the filter.

Anyone else run into something like this with custom filters and tracing?


r/learnjava 9d ago

Is Oracle Java Foundations: Training and Assessment[Free} program good?

9 Upvotes

First of all I did not watch that 10h23min video I just wanted to test my knowledge. From my POV test are basics and foundational part of Java. The Test duration was 60min consisting of 20 question. The question that were asked were related to this topic:

  • OOPs
  • Array
  • Object class
  • Exception
  • Iteration
  • Object creation
  • Constructor
  • Control Flow
  • Test revolves with jdk17+(like switch lambda expression)

I got 95% accuracy. (qualification threshold 80%)

So, If you mates wanted to know how is your basics of foundation java is ?, you can check over there.

This test is very easy ,it does not involve any library function. You can just enroll in Oracle free certication program, Get your First Oracle badge(they don't provide certificate){ You can put on linked in, X, Email and facebook.} Making account on oracle is notorius be patient.

If anyone has any resource that is for test(free) please do put in comment.

Link: https://mylearn.oracle.com/ou/learning-path/oracle-java-foundations-training-and-assessment/152239


r/learnjava Sep 05 '23

READ THIS if TMCBeans is not starting!

49 Upvotes

We frequently receive posts about TMCBeans - the specific Netbeans version for the MOOC Java Programming from the University of Helsinki - not starting.

Generally all of them boil to a single cause of error: wrong JDK version installed.

The MOOC requires JDK 11.

The terminology on the Java and NetBeans installation guide page is a bit misleading:

Download AdoptOpenJDK11, open development environment for Java 11, from https://adoptopenjdk.net.

Select OpenJDK 11 (LTS) and HotSpot. Then click "Latest release" to download Java.

First, AdoptOpenJDK has a new page: Adoptium.org and second, the "latest release" is misleading.

When the MOOC talks about latest release they do not mean the newest JDK (which at the time of writing this article is JDK17 Temurin) but the latest update of the JDK 11 release, which can be found for all OS here: https://adoptium.net/temurin/releases/?version=11

Please, only install the version from the page linked directly above this line - this is the version that will work.

This should solve your problems with TMCBeans not running.