I want to write a method which finds the longest String (word). The output should be the longest word in case of two words with the same lenght the output should be: “More than one longest word”. I used ArrayList and almost had a solution, but something goes wrong. The case is that I have a proble…
Tag: java
set class fields based on enum value
Using the above code I can get the value of Tempclass fields based on enum values. Now how to set the fields of Tempclass based on enum value ex: if enum VALUE2 is selected, then i need to set the Tempclass field2 to the input value. Answer Use a BiConsumer<Tempclass, String> taking an instance of TempC…
Database error with Java Spring boot Project
I am trying to run a Java Spring Boot survey project (Maven Architecture) in my local machine by following steps — mvn clean package connect to created jar file java -jar target/filename.jar Open browser and browse to localhost:8080 Project is running ok, I can input survey data, but I am getting follow…
Creating a new File instance with a parent directory returns a File inside the root instead of the parent
I have this method to get the directory that my Java program is running inside. But when I create a new File instance with this directory as its parent, it returns a File inside the drive’s root. I was expecting the absolute path of this file to be D:usersSimonmyprogramtestfile, but instead its D:testfi…
JavaFX TableView with array of TableColumns
I got a TableView<MonthRow> where I want to display each month of the year and its relevant days. I got those three classes for presentation purposes: And then I create the table content: Having the ObservableList now for the TableView, I am kinda stuck. I want to have one TableColumn for the month and …
How can I check if 2 given stacks has the same values? (Not necessarily in the same order)
everybody. How can I check if 2 stacks has the same values? For example, in stack1 I have [1,3,4,5] and in stack2 I have [4,3,1,5], so the stacks has the same values and the methood needs to return true. In addition, the stacks must be (in the end) as they were given (with the original values and the same ord…
denoise_TVL1 Sizes of input arguments do not match
I am trying to implement total variation algorithm on a grayscale video. As far as I understand this method(denoise_TVL1) is using that algorithm. But I get “Sizes of input arguments do not match” CvException. Could you help me to understand what the problem is? I have this list as class instance:…
Dockerfile to run a Java 11 class
I’m attempting to write the simplest docker file that will run a main class named InsertVolume in package scripts. Here is my Dockerfile : Here is the result of running command : When I then attempt to run the image using : I receive error : The mvn command mvn compile exec:java -Dexec.mainClass=”…
BufferedReader saving sentence, String array, then 2D int array
I have a .txt file that contains text that I would like to save part of it in a String, part of it in a String array, and then the last part in a 2D int array, and am faced with two issues: How to read and save both of the arrays when their size is not known ahead of
Get imageView resource
i have been searching for hours, and cant seem to find an answer i have a chess board and its made of 64 imageViews (8X8) and i want to move one pawn to another square, and cant seem to find the way to get the image resource (which is a png image) and set it on the empty square. i