Questions tagged as 'java'

2
answers

How to clean a vector?

I have a size 5 Java vector to allocate 5 first numbers. I have to empty it when it's full, in order to allocate five more numbers. And keep this routine until all numbers are read! int x[] = new int[5]; x[0] = 1 x[1] = 2 x[2] = 3 x[3] = 4 x[...
asked by 24.03.2016 / 22:01
4
answers

Regex to get a text between

I'm trying to get a word between <> . For example: Text: "Joao <[email protected]>" My regex should catch [email protected] , but it's catching <[email protected]> The regex I am using is <(.*?)>...
asked by 13.11.2015 / 20:46
3
answers

Redo the method statement

I would like to know how I can redo the instruction of a method until the user cancels. I have the following method, for example: public static void method(){ int i = 1; i += 1; String choise; println("Exit?"); choise = scan.next...
asked by 29.09.2017 / 13:32
1
answer

Is Connection Connection polymorphism?

Connection connection; connection = new ConnectionFactory().getConnection(); Can I say that doing this is polymorphism? The Connection receives the connection of class ConnectionFactory .     
asked by 13.02.2016 / 19:20
1
answer

Best approach is to filter data in the database or application?

Suppose we have a 'Vendas' table with the following 'estado', 'cidade', 'vendedor', 'valor' columns. 'estado' and 'cidade' would be where the sale was made and 'vendedor' would be what made that sale. 'v...
asked by 07.06.2017 / 19:45
2
answers

How to deal divide by 0

I have the code where there can be a division by zero: Binding binding = new Binding(); GroovyShell shell = new GroovyShell(binding); conta = shell.evaluate(conta).toString(); txtConta.setText(conta); Where on the 4th line, the evaluat...
asked by 03.07.2017 / 19:29
1
answer

Look and Feel in java

I have an application that uses Windows Look and Feel. But I have a problem where the user can have a Windows XP computer, and everything is stylized with windows XP. It has the application to stick with the compilation look and feel (or some...
asked by 23.05.2018 / 15:28
3
answers

Get value Integer in end .00 and float value in .01 to 0.9

I have this code below that is from a calculator, however I have a problem: I wanted to return a float value when dividing 5/2 = 2.5 and returning an integer value when dividing 4/2 = 2 and not 2.0 ! Can anyone help me with this? The c...
asked by 20.06.2018 / 03:38
6
answers

Check if EditText is empty

Hello everyone, I'm doing an application in android studio but I do not know exactly how to check if the text fields are empty, I tried the following solution in the code below: public class MainActivity extends AppCompatActivity { EditText...
asked by 08.08.2016 / 16:01
1
answer

Error converting string to integer

I'm trying to register a client on Android's internal DB. I have a String field where I put the user's phone. This field I convert to Integer using parseInt newCliente.setFone(Integer.parseInt(foneDesc)); If I register at mo...
asked by 08.11.2016 / 11:13