Questions tagged as 'java'

1
answer

Use a sql.Connection class for each task or only one referenced globally? [closed]

I have a class that is responsible for checking the user's account and password when logging in, and in the future I will have to implement another class to get other data in the bank and create a new connection. Would it be a good idea to us...
asked by 07.11.2016 / 02:30
2
answers

Choose which fragment will be shown in the activity

I have Activity that the email is requested and if the email exists it shows a Activity with a Fragment to enter the password. If this email does not exist, I want to display a Fragment , in the same Activity , f...
asked by 13.09.2016 / 21:34
2
answers

Size of arrays

If the theory says that the size of an array can not be changed, only the elements. Because when I print the size of a the value is 10 and not 5 or 15? int[] a; a = new int[5]; a = new int[10];     
asked by 21.11.2017 / 01:42
1
answer

Rewrite code using the try-with-resources feature [duplicate]

My problem is to rewrite a code using the try-with-resources feature, as I'm new to the programming world, I'm not able to learn how to do this, which is becoming rather overwhelming because it's apparently simple but I'm not getting it. I...
asked by 25.12.2016 / 16:02
1
answer

Is there any function for arrays in Java like PHP's join ()?

Is there a function in Java that is the same (or similar) as the join of PHP? If so, demonstrate its use.     
asked by 26.05.2017 / 16:53
1
answer

Multiplication of vectors A and B resulting in matrix C

I have a Java exercise here to solve but I can not understand exactly what I need to do, if anyone can give me an explanation, thank you! I need to do the following: Given the A = [1,2,3,4,5] and B = [1,2,3,4,5] vectors, create algori...
asked by 04.06.2017 / 21:36
2
answers

How do I check if a String is null and add to an array?

I have a problem, I have several variables (String) with the following names: texttransfer1, texttransfer2 to 73 (texttransfer73). At times the variable textTransfer2 for example may assume an empty value or not, depending on the situation....
asked by 01.06.2017 / 02:34
3
answers

Verify existence of file on the web

Next, I have an Android app, this app wants to verify the existence of a web image to be able to load Picasso, if the image does not exist in an example address www.algumacoisa.com/img/imagem5.png I will show a message . So what I need is to val...
asked by 12.05.2017 / 14:36
1
answer

"Detached entity passed to persist" when entering the second time

I'm having an error when I try to insert a new user a second time. Error: 12:51:54 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute WARNING: #{testeHibernate.save}: org.hibernate.PersistentObjectException: detached entity passed to...
asked by 31.08.2015 / 13:57
1
answer

How to convert Time type to String?

I have a horaConsulta field and I can not convert it to String DAO stmt.setTime(4, new java.sql.Time(consulta.getHoraConsulta().getTime())); Servlet Time horaConsulta = converterTime(request.getParameter("horaCo...
asked by 19.07.2015 / 19:28