Skip to content

Java Top-Down Merge Sort – Stackoverflow Error

I am trying to implement the top-down merge sort algorithm in Java, using the pseudocode from Wikipedia. My problem is that my code sometimes throws a StackOverflowError, but not always. I have checked that my code matches the pseudocode several times and cannot find what is wrong with it. Here is my Java cod…

Debugging COM interface mapping in JNA

After mapping Vss.h and several others headers to Java/JNA (see this question) I am trying to run some of the COM object methods and have a problem debugging them. I do not know if I am calling the correct method or one with similar parameters. Some of the error codes I find in the JNA documentation here, but…

How can I remove this java exception error in my code?

When I input a string into the code below by mistake as a test, I get a red java error message in my console. However, within my if statement I added an else part which should end the program if the user doesn’t input the if statement condition i.e a number between 0-100. Why this is and how can I

How to avoid java.lang.NullPointerException in my Code?

I have asked a question about my code for a Game of Life Implementation. The suggested solution solved my problem but created a new one. Now if I try to call the getCell() method I get a java.lang.NullPointerException. How can I avoid this exception? Link to my previous question with the corresponding code an…

How to properly filter Spring REST data

I have a Spring Data REST service with a single @Entity and Repository. When I run $ curl localhost:8080/api I get all the data stored in my repository and it works as expected. I also have a small React front end and I display that data there. My question is: Where should I filter the data? For example maybe…

JavaFX: How to overwrite button action in custom Dialog

I work on desktop application based on JDK 8 and JavaFX. I created custom dialog class with 2 buttons(finish and cancel). My goal is to return the list of strings added in dialog (after clicking finish button, dialog returns list. Cancel makes return empty list). I have problem, beacause function showAndWait …

Can we use semicolon independently at the beginning of a for-loop?

What is the meaning of this type of syntax in the for-loop? Answer A for statement is composed of 3 parts for(statement A; statement B; statement C): Statement A is the initializer statement. It is executed only one time. Usually, you create your variables you want to use in the for loop Statement B is the st…