Questions tagged as 'java'

1
answer

Error in query syntax in PrepareStatement

I'm getting this error message and can not find why:    You have an error in your SQL syntax; check the manual that   correspond to your MySQL server version for the right syntax to use   near '?,?,?)' at line 1 The code that returns the...
asked by 07.09.2016 / 15:08
1
answer

What is the best practice for instantiating a class in Java?

Aiming at performance, how should I instantiate an object (eg a DatabaseHandler) to be used in Fragments. Should I instantiate them in activity and pass via constructor method to Fragments or should I instantiate them in each Fragment?     
asked by 05.09.2016 / 18:10
1
answer

Java problems for calling an array

Hello, could anyone tell me why the program is not finding the array I (I'll flag in the code below: Error:    error: can not find symbol R + = I [P0]; ^ symbol: variable I location: class math 1 error class Matematica { publi...
asked by 10.12.2015 / 17:31
2
answers

Why is not the recursive function return being used?

What happens when I call a function, recursively, without assigning its return to a variable? Why is it not necessary, in this case, to explicitly assign the mergeSort function to the array variable? public static int[] mergeSort(int[...
asked by 05.12.2015 / 21:34
1
answer

Interpretation function

How does this function stay without the for loop? using ObjectOutputStream? private synchronized void adicionarListaContactosOnline(){ Set<String> listaContactosOnline = new HashSet<String>(); for(Map.Entry<Stri...
asked by 13.12.2015 / 23:44
1
answer

Check if object is part of class that implements certain interface

I need to create a condition to know if a given object is part of a class that implements a certain interface. How can I do this?     
asked by 12.12.2015 / 00:04
1
answer

How to center a JFrame on the computer screen?

I am using the NetBeans builder GUI to do some things with Swing and would like to center the JFrame , which is my application, on the computer screen. However, I do not know where I edit this part. Where is it when the program runs:...
asked by 08.04.2016 / 21:39
2
answers

Finding Object in a List

I have the following objects public class Passo { private Long id; private Date dataAtend; private Time horaRealizada; private Long idProfissionalRealizador; private String Descricao; /*getter & Sett...
asked by 10.11.2015 / 18:41
2
answers

Difficulty to define the path where given txt will be created

The following method generates a txt containing certain information: public static void gravarIp(String ip) { try { File arquivo = new File("ip.txt"); FileOutputStream fos = new FileOutputStream(arquivo); Str...
asked by 12.11.2015 / 12:05
1
answer

Method that creates a new list based on elements of an existing list?

In C # there is the function numeros.GetRange(0, quant); I would like to know which function is equivalent to numeros.GetRange(0, quant); of C # in Java     
asked by 12.03.2016 / 20:42