Skip to content
Advertisement

Getting Error while creating a package in java

while creating a package for my file it giving error message i’m running this command Answer I don’t fully understand what you tried to do there, but you should try notice the “.” is separated from the “calculator” by a space

How to parse TOML document with Java

In my Java app I get a TOML document from REST service response as String and I look how to parse it and convert to Java objects. Ideally I’d like to use some existing mapper library for deserialization, something like Jackson or Gson for JSON objects. Are there any options in Java ecosystem for that? Answer There are several libraries

Cant add to arraylist inside actionevent Buttonclicked

Im kind of new to programming in java but here im trying to figure out how to add the value of a button clicked in ActionEvent. I even changed the actionlistener to MouseListener etc but still not working. It only displays the current button clicked but i would like to add every button clicked into an arraylist. Problem: I cant

Put a file Json (array) into a zip file [Java]

Hello I’m new to java and my english is not good as well lmao I need to put a file json (it’s an array json) in a file zip trought java but i tried multiple solution and doesn’t work 🙁 this is my code: any help ? regards Answer You are creating a ZipEntry but you are not adding the

HashMap element is removed when another HashMap name remove an element

appearList is a HashMap with fixed data. I do: Then, when I remove an element from randomPersonList, that element on appearList is also removed unexpectedly. I expect to keep appearList as original. Can anyone tell me why and how to correct my code? Answer makes randomPersonList the reference to the same object as appearList. So with both variables you are

Count only currently active threads

I have a list of Thread and I want to count only currently active threads, but method isAlive() don’t work. How correctly is this or exist other method check for currently active threads. Answer tl;dr Compare the state of the thread: Here is an example making a stream from your list of Thread objects. Or count all active threads: Details

Big Decimal array not sorting 0 and 000.000

I was solving a java HackerRank problem in which I had to sort an array consisting decimal numbers using BigDecimal class in descending order. The solution works fine except for one case in which 0 and 000.000 comes. Now as they are equal, the problem tells us not keep them in the same order of their occurrence, but it is

Advertisement