r/JavaProgramming • u/cielNoirr • Jul 24 '25
How do you catch errors in your Spring Boot apps deployed to the cloud? I built a tool (n1netails) to solve this—would love feedback
r/JavaProgramming • u/cielNoirr • Jul 24 '25
r/JavaProgramming • u/CryptographerPlane35 • May 15 '25
I need help completing section b to c. I already did a,d,e,f I use netbeans with java with ant and im about to start ripping my hair out cause im new to java so if you could help me with tips,code anything i will be happy.
r/JavaProgramming • u/javinpaul • Jun 18 '26
r/JavaProgramming • u/Reality_Soggy • May 03 '21
Hi all i was given an assignment for school of making a basic game in programming java and i know nothing about programming so what i did was i asked a friend if they could do the basic game and explain the code to me after they are done, the thing is they never finished the pacman game because they had some personal problems, so now i'm stuck with a code that is almost finished ad has these small issues. Someone that know java would finish it really fast because the entire code is done its just small mistakes i don't understand, so what i am asking is if someone on here knows some java that can help me fix a code i didn't write and at the same time after its done explain it to me so i understand it enough to explain it to my teacher, preferably in a voice call but im able in chat as well. The game is a pacman game and it's written in java on the site repl.it. So what i'm asking is if anyone is able to give it a go it will take no time for someone who knows java, but i don't know java. It's basic programming because I just started.
r/JavaProgramming • u/javinpaul • Feb 17 '25
r/JavaProgramming • u/orologiostupido • Jul 13 '26
r/JavaProgramming • u/Nervous-Staff3364 • Apr 16 '25
In the world of microservices and API-driven development, contract coding refers to the process of ensuring that the client-side code (the code that consumes the API) aligns perfectly with the server-side API specification. This alignment is crucial because any mismatch between the client and the API can lead to runtime errors, failed requests, or even system outages.
Manual Effort and Human Error: Traditionally, developers manually write client code based on API documentation or specifications. This process is time-consuming and prone to human error. For example, a developer might misinterpret a field type, miss an endpoint, or fail to handle an error response correctly.
API Evolution: APIs are not static; they evolve. New endpoints are added, existing ones are modified, and some are deprecated. Keeping the client code in sync with these changes is a constant challenge. Without automation, developers must manually update the client code every time the API changes, which is tedious and error-prone.
The OpenAPI Generator addresses these challenges head-on by automating the process of generating client code from a machine-readable API specification (OpenAPI/Swagger). This approach ensures the client code is always in sync with the API contract, reducing manual effort and eliminating human error.
r/JavaProgramming • u/javinpaul • Nov 20 '25
r/JavaProgramming • u/javinpaul • Oct 10 '25
r/JavaProgramming • u/javinpaul • Jun 30 '26
r/JavaProgramming • u/SniperxAMW_ • 12d ago
import java.util.*;
class Cir_matrix
{
public static void main()
{
Scanner in=new Scanner(System.in);
int n,r,c,x,y,i,j,z=1,m;
System.out.println("Enter no. of index");
n=in.nextInt();
int a[][]=new int[n][n];
r=n-1;c=n-1;//last
int R=0,C=0;//first
m=n-2;
for(j=1;j<=m;j++)
{
for(i=C;i<c+1;i++)
{
a[C][i]=z;
z++;
}
R++;
for(i=R;i<r+1;i++)
{
a[i][r]=z;
z++;
}
for(i=c-1;i>=C;i--)
{
a[c][i]=z;
z++;
}
R--;
for(i=r-1;i>R;i--)
{
a[i][R]=z;
z++;
}
R++;C++;r--;c--;
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{ if(a[i][j]<10)
System.out.print(a[i][j]+" ");
else
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
}
r/JavaProgramming • u/lolmaz • Apr 30 '25
I wrote an article on how java is used to build AI models, also what is java strength if used for building AI models and why you should be interested, this article is inspired by a webinar I watched talking about this subject.
r/JavaProgramming • u/SangramInML • Jul 14 '25
Everywhere I look, I see posts about people getting laid off because of AI. I actually enjoy coding in Java and learning backend and architecture stuff, but now I’m burned out and can’t even focus or progress. Every day, YouTube and Reddit tell me AI will replace SDEs.
I’m in 2nd year BTech CSE (tier 3 college).
Should I continue with backend dev, or start DS/ML? I’d really appreciate your honest advice.
r/JavaProgramming • u/XIA_Biologicals_WVSU • 4d ago
This is a little program that I created with the help of AI. I only used AI when I became stuck on certain parts of the program. The program allows the user to input a file directly into the IDE, whcich allows the terminal to output what is in the file; it also allows the user to select a file to read, and finally allows the user to select a place to save a file and enter text to be saved into a file.
import javax.swing.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.awt.Desktop;
import java.util.Scanner;
import static java.awt.SystemColor.
text
;
class newProject {
public static void main(String[] args) throws IOException {
// capture user input:
Scanner scanner = new Scanner(System.
in
);
String UserData = scanner.nextLine();
System.
out
.println(UserData);
if (UserData.equals("1")) {
Files.
lines
(Path.
of
("C:/Users/zgarr/OneDrive/Desktop/text.txt"))
.forEach(System.
out
::println);
} else if (UserData.equals("2")) {
File directory = new File("C://documents");
try {
ProcessBuilder explorer = new ProcessBuilder(
"explorer.exe",
directory.getAbsolutePath()
);
explorer.start();
// User selection for number 2
} catch (IOException e) {
e.printStackTrace();
}
} else if (UserData.equals("3")) {
System.
out
.print("Enter a name for your file");
String fileName = scanner.nextLine();
if (!fileName.endsWith(".txt")) {
fileName += ".txt";
}
String folder =
chooseSaveFolder
();
File fullPath = new File(folder, fileName);
System.
out
.println("Start typing your text to save it. Type exit when finished");
try (FileWriter writer = new FileWriter(fullPath)) {
while (true) {
String line = scanner.nextLine();
if (line.equalsIgnoreCase("EXIT")) {
break;
}
writer.write(line + System.
lineSeparator
());
}
System.
out
.println("saved doucment too " + fullPath);
} catch (IOException e) {
System.
out
.println("Error saving file" + e.getMessage());
}
} else {
System.
out
.println("Wrong selection");
}
scanner.close();
}
// This method helps the user select a place to save the file
public static String chooseSaveFolder() {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Select a folder to save your file");
chooser.setFileSelectionMode(JFileChooser.
DIRECTORIES_ONLY
);
int result = chooser.showSaveDialog(null);
if (result == JFileChooser.
APPROVE_OPTION
) {
return chooser.getSelectedFile().getAbsolutePath();
}
return ".";
}
}r/JavaProgramming • u/No-Government-8159 • Apr 05 '26
Your HashMap suddenly starts behaving incorrectly in production. Why?
Answer:
* equals() and hashCode() not implemented properly
* Mutable keys being modified after insertion
* High hash collisions degrade performance
* Using a non-thread-safe HashMap in a concurrent environment
---
2) Your Java application shows high GC activity and performance drops. Why?
Answer:
* Excessive object creation increases GC pressure
* Short-lived objects flooding the heap
* Improper memory allocation patterns
* Large objects are frequently created and discarded
---
3) Your application sometimes processes the same request twice. Why?
Answer:
* Retry logic without idempotency
* Duplicate message processing in async systems
* Network timeouts causing re-execution
* Missing request deduplication logic
---
r/JavaProgramming • u/Acceptable_Emu_1878 • 21d ago
I conducted a mock interview recently and one thing stood out to me.
I asked a Java question related to concurrency:
class Counter {
private int count = 0;
public void increment() {
count++;
}
}“Is this thread-safe?”
The candidate said "No".
So I asked, “Why?”
He knew that it wasn't thread-safe, but explaining exactly why was difficult. He then said we need to synchronise the method.
So I asked:
“How does that fix it?” and then “What exactly is being locked here?”
That was where the interview got interesting.
He knew the terms — synchronised, volatile, race condition, etc. However, connecting them and explaining what was actually happening between the threads was harder.
It made me think about how easy it is to prepare for interviews by remembering rules.
count++ → not thread-safe → use synchronised
But the moment someone asks “Why?”, we need to understand what is actually happening.
I think that's something that's easy to miss while preparing for interviews. We can keep solving questions and memorising concepts, but it's worth stopping sometimes and asking ourselves:
“Can I actually explain why this works?” and “What happens if I change one thing?”
How do you guys prepare for the “Why?” part of interviews?
r/JavaProgramming • u/harshitpnd • Apr 05 '26
Honestly, getting a job in 1 month is possible, but only if you already have basics clear and stay very focused.
If you’re starting from zero, 1 month is unrealistic. But if you’ve studied before and just need direction, here’s a simple roadmap:
Week 1 – Fix fundamentals
Pick ONE stack (don’t switch)
Revise core concepts (Java + basics of backend if that’s your thing)
Solve easy DSA (arrays, strings)
Week 2 – Build + revise
Make 1–2 small projects (CRUD, login system, etc.)
Start practicing interview questions (very basic level)
Clean your resume
Week 3 – Apply aggressively
Apply daily (20–30 jobs minimum)
Practice HR + basic tech questions
Mock interviews help a lot
Week 4 – Polish + repeat
Improve weak areas from interviews
Keep applying + following up
Be ready to explain your projects clearly
From what I’ve seen, most people fail not because they lack skills, but because:
They keep switching tech stacks
They don’t apply enough
They overthink instead of practicing
Also, referrals matter more than you think—try reaching out on LinkedIn.
Curious though—are you starting from scratch or already have some coding background?
r/JavaProgramming • u/ClickOk5811 • 25d ago
Here’s the console output of a small program:
filter apple
map appleThat’s all. Four strings went in, and only the first one was ever looked at. Here’s the code:
String result = Stream.of("apple", "banana", "cherry", "date")
.filter(s -> { System.out.println("filter " + s); return s.length() > 4; })
.map(s -> { System.out.println("map " + s); return s.toUpperCase(); })
.findFirst()
.orElse("none");result is "APPLE".
Two things explain the output.
Intermediate operations don’t run on their own. filter and map only describe what should happen. Nothing executes until a terminal operation like findFirst, collect or forEach asks for elements. If you remove .findFirst().orElse("none") and leave the pipeline hanging, it prints nothing at all.
Elements flow through one at a time. Instead of running filter over all four strings, then map over the survivors, each element goes through the whole chain before the next one starts. apple passes the filter, gets mapped, and arrives at findFirst, which has what it needs, so the pipeline stops. banana, cherry and date are never touched.
That’s why peek and print statements inside a pipeline can look confusing: the order of the output isn’t “all the filters, then all the maps”.
One exception worth knowing: stateful operations like sorted() have to see every element before they can emit the first one, so they break the one-at-a-time flow. A pipeline with sorted() in the middle will process everything up to that point before anything continues.
A practical consequence is that side effects inside map or filter are hard to reason about, because whether and when they run depends on what’s downstream. I’d keep those lambdas free of side effects and use peek only for debugging.
If you’ve hit a bug that came down to laziness, I’d be interested in what it looked like. Mine tend to be the “I added a map and nothing happened” kind.
r/JavaProgramming • u/sayanfx • Aug 29 '25
I have seen many students here suggesting how to start Java journey . Let me suggest you -
Search " Durgasoft Core Java Playlist "
Check 200 hr+ very rich Playlist
Consume it, take time and fall in love with Java !!
Yes, same thing I followed and ranked 1% amongst 15k students in a National level Core Java course exam ( NPTEL )
Dear Beginners, Java is not like other programming language. Here, there is no shortcut but a long way with consistent and fruitful journey !
So, don't feel that giving time to Java will waste your time.
I'm also still on my way to become a Java Developer, had crossed the same long Core Java Steps !!
Without that kickstart, may be I won't have such solid grasp of foundation !!
r/JavaProgramming • u/SecretAdventurous631 • Jun 09 '25
It’s using Java if you’re not sure