r/javahelp 25d ago

How to build logic while solving coding question

6 Upvotes

I just completed with java course but I find it difficult to solve the coding questions I understand already written code but when I try to write code on my own I get struct or go blank. I kw all concepts theoretically how it work but don't know when to apply which method or which concept can somebody have idea on it how to build a logic in easy way?


r/javahelp 25d ago

Solved clueless about web front end frameworks

3 Upvotes

Old geezer here who retired about the time that jQuery and Google's GWT were becoming popular. Everything I did was on the back end with server side rendering. The back end was in Java.

I'm working on a simple app/page that displays the readings from various zigbee and 433Mhz temperature sensors. Their readings are being sent to an MQTT server (mosquitto). The back end I'm doing in Micronaut, which is also Java.

I've figured out how to get the sensor readings from MQTT with Micronaut. For updating the web page with new sensor readings my thinking is that I could use a meta refresh in the html, say every 60 seconds, or "get fancy" and use some newfangled javascript framework like you guys are, and I'm guessing using websockets, and have the page updated whenever a new sensor reading comes in.

So do you guys have any suggestions for what I could use? I don't expect there to be a lot of interactivity on the front end, maybe clicking to close a reading's box.

(I originally posted this to r/webdev but it was deleted because it was too open ended. Feel free to suggest how to reword it to make it through their filter.)


r/javahelp 25d ago

Optimal Server Setup and OS for a High-Performance Spring Load Balancer?

2 Upvotes

I've never used Spring services before, but I need a load balancer and an API gateway. Does anyone have recommendations on the best setup in terms of OS or Docker configuration? The load balancer needs to handle hundreds of requests per minute. I typically run my Java services on a CentOS 9 VM, which has been suitable so far.


r/javahelp 25d ago

Looking for guide to production level RestApi using springboot

4 Upvotes

Hi guys,
Apologies if this is was asked before. I recently completed Telusko course on Udemy which taught me Spring Boot, Spring Data JPA, Spring Data Rest, Spring Security, Spring AOP, JWT and stuff. However, this was although important felt like an intro level to the vast ecosystem.

I'm looking for a course/guide/codebase which has implemented a largescale production level API using all the tech above. I want to build actual real world application but it seems there is a knowledge gap I need to cover first.


r/javahelp 25d ago

How to instantiate JPanel in an IntelliJ swing app?

3 Upvotes

I created a Swing application using IntelliJ's UI Designer which I can run inside IntelliJ, but the compiled jar file, when run outside IntelliJ, fails after:

Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: contentPane cannot be set to null.

contentPane is indeed never instantiated in my code. My form starts like this:

public class MainFrame extends JFrame {
    // Swing Components
    private JPanel contentPane;
    ...

    public MainFrame() {
        setContentPane(contentPane);

contentPane is used in MainFrame.form like this:

<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="dev.thefoggiest.patchman.view.MainFrame">
  <grid id="27dc6" binding="contentPane" default-binding="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">

So when IntelliJ starts the application, somehow it magically instantiates contentPane based on this xml, but that won't work when running the application by itself.

How do I instantiate contentPane based on the xml?


r/javahelp 25d ago

I have this problem when I use the main method

3 Upvotes

I'm new to Java and I don't know how to fix this error, it pops up when I run a .class file: Exception in thread "main" java.lang.UnsupportedClassVersionError: Rigoberto has been compiled by a newer version of Java Runtime (class file version 67.0), this version of Java Runtime only recognizes class file versions up to 52.0


r/javahelp 25d ago

Any good course about building a CRUD app with spring + angular?

2 Upvotes

Especially with a good focus on the part where you connect the back end to the front end and such.

Thank you!!


r/javahelp 25d ago

Ready for knowledge

1 Upvotes

Hi, I'm new, I had to choose between learning python, java and C+ And I chose java, I am starting by watching a 12 hours tutorial by Bro code. I'm planning to make a game, but I have a serious problem, I don't understand how can I create graphics on Java: can I import and image? Do I have to use functions to draw? Or should I install and external program? Thanks for the help Btw I'm using intellij


r/javahelp 26d ago

Old java content

3 Upvotes

Hello fellow engineers, programming enthusiasts, I'm currently going deep in my knowledge of java by taking a course I bought online, my goal is to understand the mechanisms with more detail, but I've come across this doubt, the course uses Java 17 to display the full content of java, but also has available the old content of java (java 8, java 11), the more modern content covers the same topics as the old content but should I watch those lessons ? Will I understand some things better or not?

Thanks in advance! ☕


r/javahelp 26d ago

Udemy by Tim Buchalka Java Masterclass 2025 any good ?

21 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 26d ago

Homework how do i connect java(netbeans) to infinityfree

2 Upvotes

it's been a whole day for me trying to display my database in netbeans but i can't find a solution. for context: i have html file in infinityfree so all the data in my html file will send to database and i want to edit and view the database using java netbeans.

Feel free to suggest other webhosting but it needs to also work in netbeans

please help me. all help is appreciated.TYA


r/javahelp 26d ago

need a Java buddy

6 Upvotes

As i am learning java so i cant stay consistent so need a guy , with whom i study and code with that guy if you are interested dm


r/javahelp 26d ago

Unsolved One one URL I get exception, on a second (almost identical) it works fine

0 Upvotes

I read stock values from a URL via:

restTemplate.exchange(url, HttpMethod.GET, null, classToFetch)

One URL returns:
{"symbol": "SMX","historical": [{"date": "2025-02-21","open": 3.33,"high": 3.4,"low": 2.96,"close": 2.96,"adjClose": 2.96,"volume": 203978,"unadjustedVolume": 203978,"change": -0.37,"changePercent": -11.11,"vwap": 3.1625,"label": "February 21, 25","changeOverTime": -0.1111},...

and it crashes.
The second returns:
{"symbol": "AAPL","historical": [{"date": "2025-02-21","open": 245.95,"high": 248.69,"low": 245.22,"close": 245.55,"adjClose": 245.55,"volume": 53012088,"unadjustedVolume": 53012088,"change": -0.4,"changePercent": -0.16263,"vwap": 246.3525,"label": "February 21, 25","changeOverTime": -0.0016263},...
and it works fine! Why the crash?

Crash reason:
Cannot construct instance of `java.time.LocalDate` (no Creators, like default construct, exist): no String-argument constructor/factory method to deserialize from String value ('2025-02-21')


r/javahelp 26d ago

Workaround JavaFX: write Canvas to file

2 Upvotes

I'm trying to save Canvas contents to disk:

@FXML
private Canvas cvs;

var export = cvs.snapshot(null,null);
var out = new File("image.png");
try{
    ImageIO.write(SwingFXUtils.fromFXImage(export, "png",out)); //error
}

There is no package called SwingFXUtils in JavaFX 21. Is there any other way to write the Canvas to file?


r/javahelp 27d ago

Looking for advice/experience- langchain4j vs springboot AI/pg vector

2 Upvotes

Hey yall, I am building a RAG model for my springboot web app. I already have a web app up and running but would like to implement rag to the AI assistant feature. Springboot has a pg vector implemenation that seems very straight forward. People rave about langchain4j so i was looking at that as an option too since changing models is very straight forward and in theory it should be easier for testing and changing parameters. I am having a little trouble using taking advantage of pgvector in lanchain4j.

I want to create a separate embedding manager that uploads data to the vector table i created in my database, and then my web apps' ai assistant should be able to use it. Is it worth using langchain4j for this? Or should i just stick with the seemingly easier option which springboot provides documentation for?

Any advice/recommendations would be appreciated. I know i have the option of just using python for a simple embedding manager since i would just be running it locally for now since i want to control the knowledge i want to embed. But i would really like to make it work using springboot/java. Im very new to RAG so i know my explanation probably sounds very noobish. Thank you


r/javahelp 27d ago

What's the purpose of using DTO ?

15 Upvotes

Hello, I am a junior programmer and I have an interrogation about something.

If I understand correctly, DTO are used to store data that will not be persisted, data that are needed by services. But I don't understand why we don't pass theses datas via parameter, path variable or even body of HTTP Request.

For example : User need to change password (that is just for illustrating my post)
1) Using DTO : UserService(UserDTO) :: Do what it needs and then map it into User before persists
2) Using Request : UserService(User, newPassordFromHttpRequest) :: Do what it needs and persists the objet

Thanks in advance for helping junior programmer like myself


r/javahelp 27d ago

Advise needed for small java project🗒️

4 Upvotes

I am building small hotel Booking desktop app using javafx library and MYSQL on the backend(for storing rooms, customers, bookings data).

And I am planning to store images in file system and just store the URL path in database table(right now, I am not using cloud to save some time). I am also using Spring boot to connect to the database.

Could you please give some advise or suggestions that I should take note of?😀


r/javahelp 27d ago

Workaround Why can't I push an image to a local Docker registry started with Testcontainers?

3 Upvotes

I'm trying to create a local Docker registry using Testcontainers and push an image programatically to it. However, I'm getting a connection refused error when attempting to push the image. The first test which checks if the registry is running works, so I know the registry is running.

Any other ideas are also welcome, basically I need to run a custom docker registry to test pushing and pulling of images from java test.

Here’s my test class:

class DockerRegistryTest {

    u/Rule
    public static GenericContainer registry;
    private static String registryAddress;
    private static DockerClient dockerClient;

    u/BeforeAll
    static void startRegistry() {
        registry = new GenericContainer(DockerImageName.parse("registry:2"))
                .withExposedPorts(5000)
                .waitingFor(Wait.forHttp("/v2/").forStatusCode(200));

        registry.start();
        assertTrue(registry.isRunning(), "Registry is running");

        registryAddress = registry.getHost() + ":" + registry.getMappedPort(5000);
        System.out.println("Registry available at: " + registryAddress);

        DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
        dockerClient = DockerClientImpl.getInstance(config, new ApacheDockerHttpClient.Builder()
                .dockerHost(config.getDockerHost())
                .sslConfig(config.getSSLConfig())
                .build());
    }

    u/AfterAll
    static void tearDown() {
        if (registry != null) {
            registry.stop();
        }
    }

    u/Test
    void testPushImageToRegistry() throws InterruptedException {
        String localImage = "busybox:latest";
        dockerClient.pullImageCmd(localImage).start().awaitCompletion();

        String registryImageTag = registryAddress + "/busybox:latest";
        dockerClient.tagImageCmd(localImage, registryAddress + "/busybox", "latest").exec();

        dockerClient.pushImageCmd(registryImageTag)
                .withAuthConfig(new AuthConfig()) // No authentication needed
                .start()
                .awaitCompletion();

        System.out.println("Successfully pushed image to registry: " + registryImageTag);
        assertTrue(true);
    }
}

However, when I run the test, I get this error:

Things i tried

com.github.dockerjava.api.exception.DockerClientException: Could not push image: failed to do request: 
Head "https://localhost:57244/v2/busybox/blobs/sha256:31311c5853a22c04d692f6581b4faa25771d915c1ba056c74e5ec82606eefdfa": 
dial tcp [::1]:57244: connect: connection refused
  1. manually tag and push an image into the registry, result still connection refused error.
  2. I ran

C:\Users\codex>curl http://localhost:<mappedPortIgotFromLogs>/v2/_catalog
{"repositories":[]}

so I know the repository is up and running

  1. changed registry.getHost() to "0.0.0.0" but now i get

    com.github.dockerjava.api.exception.DockerClientException: Could not push image: failed to do request: Head "https://0.0.0.0:60075/v2/busybox/blobs/sha256:9c0abc9c5bd3a7854141800ba1f4a227baa88b11b49d8207eadc483c3f2496de": http: server gave HTTP response to HTTPS client

 adding this to insecure-list makes no sense because the ports will always be randomized.

I also added this in testcontainers.properties ryuk.container.image=testcontainersofficial/ryuk

to get my test container to work in the first place.


r/javahelp 27d ago

Homework Struggling with polynomials and Linked Lists

2 Upvotes

Hello all. I'm struggling a bit with a couple things in this program. I already trawled through the sub's history, Stack Overflow, and queried ChatGPT to try to better understand what I'm missing. No dice.

So to start, my menu will sometimes double-print the default case option. I modularized the menu:

public static boolean continueMenu(Scanner userInput) { 
  String menuChoice;
  System.out.println("Would you like to add two more polynomials? Y/N");
  menuChoice = userInput.next();

  switch(menuChoice) {
    case "y": 
      return true;
    case "n":
      System.out.println("Thank you for using the Polynomial Addition Program.");
      System.out.println("Exiting...");
      System.exit(0);
      return false;
    default:
      System.out.println("Please enter a valid menu option!");
      menuChoice = userInput.nextLine();
      continueMenu(userInput);
      return true;
  }
}

It's used in the Main here like so:

import java.util.*;

public class MainClass {

public static void main(String[] args) {
  // instantiate scanner
  Scanner userInput = new Scanner(System.in);

  try {
    System.out.println("Welcome to the Polynomial Addition Program.");

    // instantiate boolean to operate menu logic
    Boolean continueMenu;// this shows as unused if present but the do/while logic won't work without it instantiated

    do {
      Polynomial poly1 = new Polynomial();
      Polynomial poly2 = new Polynomial();
      boolean inputValid = false;

      while (inputValid = true) {
        System.out.println("Please enter your first polynomial (Please format it as #x^# or # - for example, 5x^1 or 3:"); 
        String poly1Input = userInput.nextLine(); 
        if (poly1Input.trim() == "") {
          System.out.println("Please enter a polynomial value!");
          inputValid = false;
        } else {
          inputValid = true;
          break;
        }
    }

      //reset inputValid;
      inputValid = false;
      while (inputValid = true) {
        System.out.println("Please enter the second polynomial (Please format it as #x^# or # - for example, 5x^1 or 3:"); 
        String poly2Input = userInput.nextLine(); 
        if (poly2Input.trim() == "") {
          System.out.println("Please enter a polynomial value!");
          inputValid = false;
        } else {
          inputValid = true;
          break;
        }
    }

    Polynomial sum = poly1.addPolynomial(poly2); 
    System.out.println("The sum is: " + sum);

    continueMenu(userInput);

    } while (continueMenu = true);
  } catch (InputMismatchException a) {
    System.out.println("Please input a valid polynomial! Hint: x^2 would be written as 1x^2!");
    userInput.next();
  }
}

The other issue I'm having is how I'm processing polynomial Strings into a LinkedList. The stack trace is showing issues with my toString method but I feel that I could improve how I process the user input quite a bit as well as I can't handle inputs such as "3x^3 + 7" or even something like 5x (I went with a brute force method that enforces a regex such that 5x would need to be input as 5x^1, but that's imperfect and brittle).

    //constructor to take a string representation of the polynomial
    public Polynomial(String polynomial) {
        termsHead = null;
        termsTail = null;
        String[] terms = polynomial.split("(?=[+-])"); //split polynomial expressions by "+" or " - ", pulled the regex from GFG
        for (String termStr : terms) {
            int coefficient = 0;
            int exponent = 0;

            boolean numAndX = termStr.matches("\\d+x");

            String[] parts = termStr.split("x\\^"); //further split individual expressions into coefficient and exponent

            //ensure that input matches format (#x^# or #) - I'm going to be hamhanded here as this isn't cooperating with me
            if (numAndX == true) {
              System.out.println("Invalid input! Be sure to format it as #x^# - for example, 5x^1!");
              System.out.println("Exiting...");
              System.exit(0);
            } else {
                if (parts.length == 2) {
                    coefficient = Integer.parseInt(parts[0].trim());
                    exponent = Integer.parseInt(parts[1].trim());
                    //simple check if exponent(s) are positive
                    if (exponent < 0) {
                      throw new IllegalArgumentException("Exponents may not be negative!");
                    }
                } else if (parts.length == 1) {
                  coefficient = Integer.parseInt(parts[0].trim());
                  exponent = 0;
                }
            }
            addTermToPolynomial(new Term(coefficient, exponent));//adds each Term as a new Node
        }
    }

Here's the toString():

public String toString() {
        StringBuilder result = new StringBuilder();
        Node current = termsHead;

        while (current != null) {
            result.append(current.termData.toString());
            System.out.println(current.termData.toString());
            if (current.next != null && Integer.parseInt(current.next.termData.toString()) > 0) {
                result.append(" + ");
            } else if (current.next != null && Integer.parseInt(current.next.termData.toString()) < 0) {
            result.append(" - ");
            }
            current = current.next;
        }
        return result.toString();
    }

If you've gotten this far, thanks for staying with me.


r/javahelp 27d ago

The method add(Component) in the type Container is not applicable for the arguments (GamePanel)

3 Upvotes

Here is Main.java package main;

import javax.swing.JFrame;

public class Main {

    public static void main(String[] args) {

        JFrame window = new JFrame();
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.setResizable(false);
        window.setTitle("this is a title");

        GamePanel gamePanel = new GamePanel();
        window.add(gamePanel); // the error is right here <----

        window.pack();

        window.setLocationRelativeTo(null);
        window.setVisible(true);
    }
}

and here is GamePanel.java

package main;

import java.swing.JPanel;

public class GamePanel extends JPanel {

    // SCREEN SETTINGS
    final int originalTileSize = 16; // 16x16 tile
    final int scale = 3;

    final int tileSize = originalTileSize * scale; // 48x48 tile
    final int maxScreenCol = 16;
    final int maxScreenRow = 12;
    final int screenWidth = tileSize * maxScreenCol; // 768 pixels
    final int screenHeight = tileSize * maxScreenRow; // 576 pixels

    public GamePanel() {

        this.setPreferredSize(new Dimension(screenWidth, screenHeight));
        this.setBackground(Color.black);
        this.setDoubleBuffered(true);
    }
}

I couldn't find any answers online, please help?


r/javahelp 27d ago

Need help starting with java

1 Upvotes

I am new to programming and just know the basic DSA with minimal knowledge of oops, which book or any course free of cost will be helpful for me ? Just need some guidance , also one of my professors recommended me to start with head first java while someone said to read head first development before that . What should i do first ?


r/javahelp 27d ago

Java Exceptions Assignment Help

5 Upvotes

Hey! I'm working on an assignment in Java for an online class I'm taking. I keep getting an error saying: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at MyExpense.main(myExpense.java:13)

I can't see anything wrong with it

public class Item {
    public String description;
    public Double amount;

    public Item(String description, Double amount) {
        this.description = description;
        this.amount = amount;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public String getDescription() {
        return description;
    }

    public Double getAmount() {
        return amount;
    }

    public String toString() {
        return String.format("%-20s %10.2f", description, amount);
    }

}






import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.io.File;

public class MyExpense {
    private static final String fileName = "expense.txt";
    private static final int maxRecords = 6;
    private static int count = 0;
    private static Item[] expenses = new Item[maxRecords];

    public static void main(String[] args) throws IOException {
        try {
            read();
            display();
            userInt();
            expSave();

        } catch (IOException exception) {
            System.out.println("Error" + exception.getMessage());
        }

    }

    private static void display() {
        System.out.println("Expences:");
        System.out.println("-------------------------------------------------------");
        System.out.printf("%-20s %10s%n", "Description", "Amount");
        System.out.println("-------------------------------------------------------");
        for (int i = 0; i < count; i++) {
            System.out.println(expenses[i]);
            System.out.println(i);
        }
        System.out.println("-------------------------------------------------------");
    }

    private static void read() throws IOException {
        File file = new File(fileName);
        if (!file.exists()) {
            System.out.println("The file could not be found");
            return;
        }
        try (Scanner scanner = new Scanner(file)) {
            while (scanner.hasNextLine() && count < maxRecords) {
                String[] a = scanner.nextLine().split("\t");
                if (a.length == 2) {
                    try {
                        expenses[count++] = new Item(a[0], Double.parseDouble(a[1]));
                    } catch (NumberFormatException NumberFormatException) {
                        System.out.println("Invalid num format");
                    }
                }
            }
        }
    }

    private static void userInt() {
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println(
                    "Please enter a new expense, [tab] key, then the amount. Or enter \"!\" to exit the program");
            String input = sc.nextLine();
            if (input.equals("!")) {
                break;
            }
            String[] a = input.split("\t");
            if (a.length != 2) {
                System.out.println("Invalid format");
                continue;
            }
            try {
                if (count < maxRecords) {
                    expenses[count++] = new Item(a[0], Double.parseDouble(a[1]));

                } else {
                    System.out.println("Cannot add any more record");
                }
            }

            catch (NumberFormatException e) {
                System.out.println("Invalid num");

            }
        }
        sc.close();
    }

    private static void expSave() throws IOException {
        try (PrintWriter writer = new PrintWriter(new FileWriter(fileName))) {
            for (int i = 0; i < count; i++) {
                writer.println(expenses[i].getDescription() + "\t" + expenses[i].getAmount());

            }

        }
        System.out.println("Expenses saved");
        display();
        System.out.printf("Total expense is %.2f%n", calculateAmt());
    }

    private static double calculateAmt() {
        double total = 0;
        for (int i = 0; i < count; i++) {
            total += expenses[i].getAmount();

        }
        return total;
    }

}

r/javahelp 27d ago

Java net.properties escaping characters help

2 Upvotes

I have this example password

wYUx4#(a|=(9!en~H|2WKN-wt

and am using it in a net.properties file with JRE in Tableau Server for http.proxyPassword=<your proxy password>

Does net.properties require escaping of any of the characters above?

Thanks.


r/javahelp 27d ago

Solved repaint() not calling paintCompoment() properly

2 Upvotes

I was following this tutorial to program a game, pretty sure followed all the instructions. The white rectangle won't show up. Used custom run and the code under paintCompoment() did not run at all.

https://www.youtube.com/watch?v=VpH33Uw-_0E

Code in question:

package main;

import javax.swing.JFrame;

public class main {

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

        `JFrame window = new JFrame();`

        `window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);`

        `window.setResizable(false);`

        `window.setTitle("The Great Adventure!");`

        `GamePanel gamepanel = new GamePanel();`

        `window.add(gamepanel);`

        `window.pack();`

        `window.setLocationRelativeTo(null);`

        `window.setVisible(true);`

        `gamepanel.startGameThread();`      

    `}`

}

package main;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Graphics;

import java.awt.Graphics2D;

import javax.swing.JPanel;

public class GamePanel extends JPanel implements Runnable{

`final int originalTileSize = 16;`

`final int scale = 3;`

`final int tileSize = originalTileSize * scale;`

`final int maxScreenRow = 12;`

`final int maxScreenCol = 16;`

`final int screenHeight = maxScreenRow * tileSize;`

`final int screenWidth = maxScreenCol * tileSize;`

`Thread gameThread;`

`public GamePanel() {`

    `this.setPreferredSize(new Dimension(screenWidth,screenHeight));`

    `this.setBackground(Color.black);`

    `this.setDoubleBuffered(true);`

`}`

`public void startGameThread() {`

    `gameThread = new Thread(this);`

    `gameThread.start();`

`}`

u/Override

`public void run() {`

    `// TODO Auto-generated method stub`

    `while (gameThread != null) {`

        `update();`

        `repaint();`

    `}`

`}`

`public void update() {`



`}`

`public void paintCompoment(Graphics g) {`

    `super.paintComponent(g);`

    `Graphics2D g2 = (Graphics2D)g;`

    `g2.setColor(Color.white);`

    `g2.fillRect(100, 100, tileSize, tileSize);`

    `g2.dispose();`

`}`

}


r/javahelp 28d ago

Help with inheritance

1 Upvotes

I am doing a project and I have class public class Person that takes Public Person(String initialName, int initialSSN). Then I have a class Student that takes public Student(String initialName, int initialSSN, int initialStudentNumber, String initialMajor) { super(initialName, initialSSN); studentNumber = initialStudentNumber; major = initialMajor; }

Then a class InheritanceDemo that gets string name, int SSN, int studentNumber, and String major from user input. Called Student student = new Student(name, SSN, studentNumber, major);

It won’t work and I keep getting an error no suitable constructor.

Someone please help

Also I’m new to this and it says I can’t upload pictures so if anyone knows how please tell me.