Category "java"

How can I change a value in a set method depending on a boolean's answer in Java?

I'm trying to change the VAT rate of an item depending if it's a luxury item or not. I've tried using an if inside of my set method but it only uses the pre-set

How can I get N smallest number in an array?

I'm trying to get the N smallest numbers (given by the user) in an array without using methods like sort()... in the last step, I keep getting only the smallest

error gradle when update to bumblebee android studio version

today, i update to bumblebee android version, and i create new project and i import some lib, include dagger-hilt. in build.gradle (module) i insert: plugins {

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified

App crashes at runtime with the following error : java.lang.IllegalArgumentException: maa.abc: Targeting S+ (version 31 and above) requires that one of FLAG_IM

Can I set readOnly false when I use findById with JPA

I have a problem with modifying data while setting database replication Before DB replication, I get data that I want to modify using repository.findById() and

What is the disadvantage of using a ForkJoinPool when it is not needed?

Imagine a scenario where a task can be divided into sub-tasks, each of which does some long running process. Assuming that this heavy task occurs only in 5/100

How to fix an error with connecting an IP camera using opencv in java?

I downloaded the app to the IP camera phone and I want to get the video via opencv,but it gives an error public class Main { static {System.loadLibrary(Core

How to "require" module "gwt.user" On Java, JDK17, "module-info.java", Netbeans, Maven

I am trying to keep up with the new changes in Java, one step a time. I am updating my old libraries with module-info.java files. I have a very simple project n

Distinct and List of other column in postgresql

I am using postgres DB and i have table with two column name and sal . name Sal Raunak 10000 Raunak 5000 Rahul 500 Raunak 300

Rest API: HTTP Status code for Informational Message

If end user not send query parameter then i want to return a message like: return Response.status(500).entity("If you wish to download whole offerings data send

FastJson with putDeserializer leads to StackOverflowError

Deserializing object using FastJson with putDeserializer leads to StackOverflowError. What am I doing wrong? test.json { "openapi": "3.0.1", "info": { "

Validate parameters passed into Constructors during compile time

In a huge project with tens of thousands of Java files there are a couple of Java classes where developers may pass in strings as parameters to a constructor cl

Android 12 Splash Screen API - Increasing SplashScreen Duration

I am learning Android's new SplashScreen API introduced with Android 12. I have so far gotten it to work on my Emulator and Google Pixel 4A, but I want to incre

How to make a vertical side menu, Jmenus in swing?

I'm relatively new to java swing, so I don't know to change the menu component in swing with a vertical one.

Application throwing 500 error when image not found instead of 404

We have shifted from Jboss 6 to Jboss 7.2.9 and we observed one changes in the site. Earlier when we were not find an image then we were getting 404 error which

JavaFX ImageIO.write() doesn't save modified BufferedImage

I'm trying to create an application that lets users modify pictures and then save them. I'm having trouble with the saving part. This is the method that rotates

Random/SplittableRandom error while building quarkus native image with optaplanner

I encounter this "Random/SplittableRandom" error while building my quarkus optaplanner application in a native image: docker run --env LANG=C --rm -v /Users/use

Not able to run Junit test with H2 database SpringBoot

I have a strange problem with my unit test.. My goal is to run test on a H2 database and not on my Mysql database.. Actually the strange thing is that when i cl

Interfaces and static methods in java [closed]

It occurred to me that interfaces cannot be instantiated and hence I could create an interface containing only a bunch of static utilities met

Need help on Arraylist quicksort and partition

Instructions: Given a main() that reads user IDs (until -1), complete the quicksort() and partition() methods to sort the IDs in ascending order using the Quic