Questions tagged as 'java'

1
answer

Error in the algorithm equation of the second degree in java

Good morning, could someone help me understand why my code is not doing the correct processing and why my conditional deviation is wrong? public void cap4ex3e(){ double a,b,c,delta,x1,x2; Scanner in = new Scanner(System.in); a = in...
asked by 17.07.2018 / 14:19
2
answers

Java conversion to Kotlin

One of the qualities mentioned in the Kotlin language is the creation of clean code, that is, code that is pleasant to read and can accomplish its purpose without curling. From what I've seen, Android Studio contains a translation for Kotlin,...
asked by 01.08.2017 / 20:59
2
answers

ReplaceAll () does not remove "|"

I have a string "|" and would like to replace with a simple "", my java code in a simplified way looks like this: String teste = "|A|B|C"; teste.replaceAll("|",""); Output: "|A|B|C" I would like the output to be without the "|", I alre...
asked by 24.10.2017 / 12:57
3
answers

Date does not receive value more than 30 days

I'm having a code that I want to check if the date is greater than 30 days with the JodaTime, but putting in the console output the value is not assigned. I have seen the following: link And I did the same idea, but it still did not work....
asked by 29.09.2017 / 17:19
3
answers

Method to save several "Players" in a list

I want to make a party system, the only command will be /party PLAYER (if player is already in party , it will be removed and if it is not, it will be added). But I did not find a way to do this, I tried with HashMap using...
asked by 25.07.2015 / 01:41
3
answers

How to recover user session

I wanted to just retrieve a user's session. I have a class called SystemUser , which identifies which user is logging on. In this class, I get the session and play for an object. @ManagedBean(name = "usuarioLogado") @SessionScoped public clas...
asked by 26.10.2015 / 02:08
3
answers

How to select a piece of Java string?

I have String x = "@646646&" . I would like to get everything between @ and & and play on other String . Regardless of what is between these characters be number or not. How do I do it?     
asked by 29.03.2017 / 15:14
3
answers

How can I separate a string eg 36529874 two by two without having any separation character eg 36.52.98.74

I'm getting the IMEI from the phone and I have to split it into groups of 2 characters so I convert them to hex afterwards. This String comes with no separator, the numbers come together, for example 36529874 and I wanted to separate them int...
asked by 30.03.2015 / 18:42
3
answers

How to count characters from a reference in Java?

Example I have some character 123456789.123456789 . How to count to . after . count again remembering that the point should not be counted.     
asked by 11.03.2015 / 14:39
2
answers

Exception vs RuntimeException, when using one or the other?

I was this doubt , and when I was informed of it, another one came up to me, which I would like to clarify. What is the difference between Exception and RuntimeException ? When using Exception or RuntimeException...
asked by 24.03.2015 / 20:56