I need a way to take specific “random” numbers from a string and put them each in separate int variables. For example this string cannot/shouldnt be changed: String date = “59598 22-01-19 22:46:32 00 0 0 66.2 UTC(NIST) * “; I need these three numbers in separet ints “22-01-19R…
Tag: string
ArrayIndexOutOfBoundsException when finding words in an array that and with a specific letter
I am trying to find words in an array that end with a letter ‘a’. I thought of doing it using two for loops but I keep getting integer out of bounds error. Could anyone tell me what i am doing wrong? The code: Answer You’ve got too much code for the task, which has lead to a bug creeping
Why does my code about Bracket Fixing hangs?
My code makes an incomplete combination of expressions with closing brackets”)” to a complete combination of expressions with the right placement of Opening Brackets “(“. If closing brackets and opening brackets are still not equal, make the first expressions to the last a priority, if…
When having String and int as an output – how do I print string first?
This code doesn’t work, whenever I as an user input String data first and then int data, it just accepts input and doesn’t print out the data. If I change: position of these two code blocks, and enter int first and String as second value after then it happily prints first int number and then Strin…
Finding the longest word ArrayList /Java
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…
Java – code will always throw a Null Pointer Exception when no Property is present?
I have inherited the following java code, that gets the value of a property from a properties file: The intended behavior in the above flow is that personName will either be retrieved from the properties file or will be returned as null if its not there, and handled accordingly. However when the property is n…
How to avoid escaping /n on each microservice in the chain? Java
For example, we are getting a json message like this from our partner: The partner wants the client to receive the message like this (without newline but with n) But we have a chain of microservices in our ecosystem and that json goes through 4 or 5 microservices which proccesing it before client can get it. …
Java – Check if user input partialy matches another string?
I have a problem where i want to see if the input user has enterd partially matches, or as long as majority matches with the answer, if it does then it should print out “Almost correct”. For example lets say the answer is Football, but user instead puts in Footbol. It should then print out Almost …
Java – JTextArea refuses to print strings that are just whitespace [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed last year. Improve this question I have …
Java Generics – Type must be from Class T “or” extend S
I am developing a ComboBox (more for context than actual significance), and I would like to know if the “or” operator exists in Java generics. For now, the declaration looks something like that: Where ComboBoxItem is an interface I created for items that can be used in the ComboBox. However, IR…