r/javahelp • • Jan 27 '26

I suck at java and it drives me nuts

23 Upvotes

Right I hope someone has had issues to the same degree as me because ultimately I feel like an idiot and want to believe that is just a 'learning curve' type thing; I apologise if I sound like an idiot since my java knowledge isn't great.

I'm learning CS at my uni and am a first year and we do Java; being introduced to OOP feels like hell and I feel like im over complicating something since I refuse to believe what im thinking about is so difficult to comprehend. Point is, the whole idea of constructors as a whole is gobbledygook to me; the idea of their being private/public fields, making new objects that start with the name of the constructor. Why we have constructors and why not just write everything in 1 file if possible; and even like parameters and how do they work for constructors. I watch videos; it somewhat makes sense, trying to apply that afterwards makes me feel like an idiot. And I refuse to use any form of AI, I know if I start I won't stop and coders somehow managed before AI was a thing back in the day so it's not like I can't. Could anyone help; has anyone dealt with something like this?


r/javahelp • • Dec 16 '25

Do people refer to JPA/Hibernate/Spring Data as the same thing?

23 Upvotes

I understand that JPA are the rules, Hibernate generate the SQL, and Spring Data (Spring Data JPA) generate the automatic methods like 'findById'

But do they generally mean the same thing? Like if someone says 'Do you use JPA?' is it the same as saying 'Do you use Hibernate?' or 'Do you use Spring Data?'


r/javahelp • • Feb 23 '25

Udemy by Tim Buchalka Java Masterclass 2025 any good ?

23 Upvotes

what to learn java like total beginner ,and how i read this one have over 120h

and it is project based tutorial vs mooc that is just pure go by go that lead u nowhere without project examples.(how i understand) .


r/javahelp • • Aug 05 '24

Unsolved Is really important to create Interface and impl for every service we have?

23 Upvotes

Hello

I am confused to create the interface for each service I have

For example, I have a service to call a rest api, someone told me that first you should create an interface for the service and create an impl for the class, but why?

We have only one class and no polymorphism

this creation interface for every service not related for Interface Segregation Principle in solid?


r/javahelp • • Dec 12 '22

I do not understand what hard-coding is and someone told me that my code is hard-coded, could someone help explain and tell me what I have to revise? Thanks.

23 Upvotes
public class lab6 {

public static void main(String\[\] args) {

	

	final int i = 1;

	final int j = 4;

	

	for (int x = 1; x <= j; x++)					//A

	{

		System.out.printf("%1.0f", Math.pow(x, i));

	}

	

	System.out.println(" ");



	for (int y = 1; y <= j; y++)				//A

	{

		System.out.printf("\*");

	}

	

	System.out.println(" ");

	

	for (int z = 1; z <= j; z++)				//A

		{
                    System.out.printf("%1.0f*", Math.pow(z, i));
		}

	

	System.out.println(" ");

	

	for (int q = 1; q <= j; q++)			//B

	{

		System.out.printf("\*");

		System.out.printf("\\n");

	}

	

	

	System.out.println(" ");

	

	for (int r = 1; r <= 4; r++)			//C

	{

		for (int t = 1; t <= 3; t++)

		{
                    System.out.printf("*");
		}

		System.out.println();

	}

	

	System.out.println(" ");

	

	

	for (int drt = 1; drt <= 9; drt++)			//D

	{

		for (int ikl = 1; ikl <= 15; ikl++)

		{
                    if(drt <= 3 && (ikl <= 6))
                    {
                    System.out.printf(" ");
                    }
                    else if(drt >= 7 &&(ikl >=10))
                    {
                    System.out.printf(" ");
                    }
                    else if(drt >= 1 &&(ikl >= 15))
                    {
                    System.out.printf(" ");
                    }
                    else if(drt >= 7 &&(ikl <= 6))
                    {
                    System.out.printf(" ");
                    }
                    else if(drt <= 3 &&(ikl >=10))
                    {
                    System.out.printf(" ");
                    }
                    else if(drt <= 10 &&(ikl <=1))
                    {
                    System.out.printf(" ");
                    }
                    else
                    {
                    System.out.printf("*");
                    }
                    }

		System.out.println();

	}

	System.out.println(" ");

	for (int eap = 1; eap <= 4; eap++)								//Ea

	{

		for (int klp = 1; klp <= eap; klp++)

		{
                    if(eap == klp)
                    {
                    System.out.printf("*");
                    }
                    else
                    {
                    System.out.printf(" ");
                    }
		}

		System.out.println();



	}

		System.out.println(" ");

	

		for (int eab = 4; eab >= 1; eab--)								//Eb

		{
                    for (int kld = 1; kld <= eab; kld++)
                    {
                    if(eab == kld)
                    {
                    System.out.printf("*");
                    }
                    else
                    {
                    System.out.printf(" ");
                    }
                    }
                    System.out.println();
		}

	

		System.out.println(" ");

	

	for (int e = 1; e <= 4; e++)			//Fa

	{

		for (int w = 1; w <= e; w++)

		{
                System.out.printf("*");
		}

		System.out.println();

	}

	

	

	System.out.println(" ");

	

	for (int er = 1; er <= 4; er++)					//Fb

	{

		for (int wf = 1; wf < 6 - er; wf++)

		{
                System.out.printf("*");
		}

		System.out.println();

	}

	

	System.out.println(" ");

	

	

	for (int as = 1; as <= 4; as++)						//Fc

	{

		for (int gy = 3; gy>= as; gy--)

		{
                System.out.print(" ");
		}

		for (int fc = 1; fc <= as; fc++)

		{
                System.out.printf("*");
		}

		System.out.println();

	}

	

                System.out.println(" ");



	for (int df = 0; df <= 4; df++)				//Ga

	{

		for (int gh = 0; gh <= 4 - df; gh++)

		{
                    System.out.printf(" ");
		}

		for (int k = 1; k <= 2\*df-1 ; k++)

		{
                    System.out.printf("*");
		}

		System.out.println();

	}

	

	System.out.println(" ");

	

	for (int labd = 4; labd > 0; labd--)				//Gb

	{

		for (int qwerty = 0; qwerty <= 4 - labd; qwerty++)

		{
                    System.out.printf(" ");
		}

		for (int o = 1; o <= 2\*labd-1 ; o++)

		{
                    System.out.printf("*");
		}

		System.out.println();
}

	for (int fd = 0; fd <= 4; fd++)					//Gc

	{

		for (int gf = 0; gf <= 4 - fd; gf++)

		{
                    System.out.printf(" ");
		}

		for (int f = 1; f <= 2\*fd-1 ; f++)

		{
                    System.out.printf("*");
		}

		System.out.println();

	}

	

	for (int don = 4; don > 0; don--)

	{

		for (int gof = 0; gof <= 4 - don; gof++)

		{
                    System.out.printf(" ");
		}

		for (int ktr = 1; ktr <= 2\*don-1 ; ktr++)

		{
                    System.out.printf("*");
                   }

		System.out.println();

	}

		System.out.println(" ");

		System.out.println(" ");
		for (int iop = 1; iop <= 21; iop++)			//H

		{
                    for (int jhk = 1; jhk <= 30; jhk++)
                    {
                    if(iop == 10 && (jhk == 15))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 11 && (jhk == 15))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 9 && (jhk == 15))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 8 && (jhk == 15))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 12 && (jhk == 15))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 11 && (jhk == 16))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 9 && (jhk == 16))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 8 && (jhk == 16))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 12 && (jhk == 16))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 10 && (jhk == 16))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 8 && (jhk == 17))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 9 && (jhk == 17))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 10 && (jhk == 17))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 11 && (jhk == 17))
                    {
                    System.out.printf(" ");
                    }
                    else if(iop == 12 && (jhk == 17))
                    {
                    System.out.printf(" ");
                    }
                    else
                    {
                    System.out.printf("*");
                    }
                    }
                    System.out.println();
		}

	

	}
}

r/javahelp • • Aug 07 '22

Java GUI Framework to learn in 2022?

23 Upvotes

I want to learn a Java GUI dev framework, but I don't know which ones are used nowadays.
I've seen people talking about JavaFX and Swing, but I don't know if any of those are outdated or not used anymore. And also, does any of these come with a Scene Builder like QT or do I have to do everything manually like you do with TKinter (in python). Any suggestions are appreciated :D


r/javahelp • • Aug 05 '21

Solved Fun Reverse Engineering Experiment

23 Upvotes

EDIT: SOLVED! HERE IS AN IMAGE FROM NOKIA DAYS FOR YOUR NIGHTMARES

https://ibb.co/TvsM8Xt

Here is the UESP wiki with the sprites: https://en.uesp.net/wiki/Stormhold:Bestiary

Hey y'all I'm trying to help out the folks at the Elder Scrolls Wiki archive some old Nokia phone game Sprites!

After many hours of working through the decompiled source I've identified a single file which extracts the .cus files image data

https://github.com/dionthorn/ReverseEngineerTesting/blob/main/src/ProgSeven.java

I've written a custom extractor which converts it into a BufferedImage

https://github.com/dionthorn/ReverseEngineerTesting/blob/main/src/TESTEXTRACT.java

Only problem is they come out Yellow* check update at bottom

https://ibb.co/svPfBt2

I'm pretty sure it has to do with the configuration of the ColorModel for the BufferedImage and I'm pretty sure it needs to be ARGB4444 any pointers? Here is the docs from nokia for the graphics call they use:

DirectUtils.getDirectGraphics(graphics).drawPixels(
 ProgFive.vectorA[staticInt].ProgSeven,
 true,
 0,
 ProgFive.vectorA[staticInt].byteMatrix,
 n3,
 n4,
 ProgFive.vectorA[staticInt].nMinus2,
 ProgFive.vectorA[staticInt].incrementShortZ,
 0,
 4444
);

where 4444 is the int value of DirectGraphics.TYPE_USHORT_4444_ARGB

https://nikita36078.github.io/J2ME_Docs/docs/Nokia_UI_API_1_1/com/nokia/mid/ui/DirectGraphics.html#TYPE_USHORT_4444_ARGB

This is purely for educational fun and archival purposes. I won't be providing the actual .cus asset files, though they are easily found if wanted.

UPDATE:

Got Pink sprites now: https://ibb.co/c3wXDg7

Messing with the ColorSpace and maskings check updates in TESTEXTRACT.java

I DID IT!:

https://ibb.co/61PKzPK

Will upload solution as TESTEXTRACT.java update to the github give me a sec


r/javahelp • • Apr 17 '21

How to convert from Int [][] to Char [][]

23 Upvotes

Hello, I need some help on how to convert an Int [][] to Char [][]. The values in Int table are numbers from 0 to 5 and I need to change their value to a certain character for each of them (?:/% _). Thank you for your time and help in advanced :)


r/javahelp • • Dec 24 '20

Can someone help me with Oauth2 and Google api?

23 Upvotes

Hey guys I want to get my data from Google fit, so I guess I have to use the Google fit api but I don't really understand how Oauth2 works. Am I really obligated to use it if I just want to get my personal data? And if yes how can I make a http request with it? Thank in advance for helping me!


r/javahelp • • Nov 16 '20

Codeless JavaFX vs Swing for polished GUI

23 Upvotes

Do you guys have any good links or books where I can really read the difference between JavaFX and Swing?
I would like to create a really polished GUI, very modern and minimalistic, lightweight, mostly used to input informaion (through text areas, radio buttons, tick boxes) and do calculations. Nothing too complex on the logics side, but I want to include a couple of 3D animations I made in Blender in the GUI itself.
I have been google-ing a lot, but I can't seem to make up my mind. Do you have any suggestions?


r/javahelp • • Sep 02 '20

Unsolved Math.round() rounding properties

23 Upvotes

Good morning Reddit, So I’m using math round to round some ints. Everything is fine except that if I try to round 445 it rounds to 450. This behavior is fine and acceptable but I’m trying to round to the hundredth digit. This means I want 445 to become 500 from going 445 to 450 and then 500. Is this possible with math round and anyone knows how? I’ve already been on google and stackoverflow but can’t find nothing that worked...

Thanks in advance!


r/javahelp • • Aug 13 '20

Codeless When using threads, is it better to implement runnable or extend thread?

23 Upvotes

was working with the Conucurrency API and this question came in my head

edit: i am reading the comments now


r/javahelp • • Aug 09 '20

Examples of open source repos illustrating integration tests with spring?

23 Upvotes

Are there any repos you can recommend to see how people are running integration tests with spring?

Thinks like context configuration, parrallelization of test suites would be useful to see.


r/javahelp • • May 28 '20

Codeless I am trying to teach myself code... but I don't know where to even start. Help?

23 Upvotes

I have taken intro to computer science where we learned basic java (up to loops and methods and all that). I want to learn more to further my knowledge. Where should I go?


r/javahelp • • Feb 21 '20

Finding every 5th number between 0-50 using for loops?

23 Upvotes

I’m brand new to java and we started recently learning loops. I’m incredibly confused by how to find every 5th number and have been working on this particular problem for hours. Please help :(


r/javahelp • • Feb 08 '20

Beginner code: I need help understanding the last part of this program

23 Upvotes
import java.util.Scanner;

public class SeparatingCharacters {

    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        
        System.out.print("Type your name: ");
        String name = reader.nextLine();
        
        int i = 0;
        while (i < name.length()) {
            System.out.println(i+1 + ". character: " + name.charAt(i));
            i++;
        }
    }
}

Test code:

Type your name: Paul

  1. character: P

  2. character: a

  3. character: u

  4. character: l

This is a program that asks for the user's name and gives its characters separately. I just don't understand the bit of code from int i = 0 to i++. I'm still practicing while loops. Thank you!


r/javahelp • • Oct 26 '19

On where to store large amounts of dialogue text in a Java based video game.

23 Upvotes

I'm curious as to what the best approach would be when writing a game in Java with pages and pages of dialogue. Where to store the dialogue, how to access and retrieve it, how to keep track of what's stored where and who says it as the cast of characters increases, and how to do all of this while neither progressively making the game laggier nor rapidly reaching a point where I my reading comprehension of my own code drops to zero.

I'm sure there's a number of easy solutions I'm missing because of my pea sized brain. I'd appreciate any ideas you could throw me, even more so if you could explain in detail (or link to someone who already has). Further notes in the comments.


r/javahelp • • Sep 30 '19

Quick beginner question: let’s say I scan the users answer to “what is your gender?” A) Male B) Female How do I store A as “male”?

23 Upvotes

I want to follow up with a question: Gender: Male Is this correct?


r/javahelp • • Jun 08 '19

What’s the most recommended way to learn Java backend for experienced iOS developer?

23 Upvotes

I guess this is a general question. I am an iOS dev for 5 years experience. I am having java Sprint Boot/ MVC / Cloud course online. I think it will be a good start to learn about the basics.

What should I do after this? I’m planning to find some popular demo repo on github and read their code. Obviously everything gonna combine with me experimenting all the time.

What do you guys think?

Thanks in advance.


r/javahelp • • Jun 03 '19

New at programming

23 Upvotes

Hello everybody ^^.

Im new at programming and I would like to start with java but i dont know where to start, so im here to ask for some help, already have an ide (eclipse) and java SE.

Thanks you for any tip/help and have a good day ^^.


r/javahelp • • Mar 16 '19

Solved I'm a beginner learning Java in school.We use BlueJ. I need help understanding incrementing and decrementing.

23 Upvotes

For this question:

int i=0;

boolean t=true;boolean f=false,b;b=(t && ((i++)==0));

b=(f && (i+=2)>0);

System.out.println(i);

By employing what my teacher taught me, I concluded that the value of i is 3, but the correct value, as I found out, is 1.

Could someone please explain to me how I should evaluate such problems/questions ?


r/javahelp • • Dec 14 '18

Why do we not import `System.out.println` to and avoid rerwriting it every time we print something to the console ?

23 Upvotes

I find myself writing System.out.println a thousand times just to print something to the console. And before jshell came along it was and still a hurdle to quickly print something to the console. Why is it not popular to simply important those specific static field or method like for example import static Java.lang.System.out;


r/javahelp • • Oct 08 '18

I cant wrap my head around this piece of code

23 Upvotes

int i=3, j=5;

int k = (i++)+j;

System.out.println(i + " " + j + " " + k);

I feel pretty dumb because it outputs 4 5 8

I was sure it would output 3 5 9


r/javahelp • • May 27 '18

[JavaFX] Tutorial how to create 2D Spaceship game for begginers

23 Upvotes

Hello guys, every java student that would like to create its first game project in java but feels like he won't manage to do it alone is invited to take a look at my javafx game tutorial - right here.

I tried to make the game as simple as possible.

This tutorial is also good for people who would like to get to know more javafx.

This is my first tutorial on youtube, so any constructive criticism (both about code and recording quality/vocabulary/speed of speaking etc.) will be appreciated.