Questions tagged as 'java'

4
answers

How to create a class in java?

I would like to know how to create a class in java , how to use this class in the main program and how the variable created in that class is.     
asked by 04.06.2015 / 18:49
2
answers

Contest question: Java code about overwriting methods

I took a quiz and dropped the following question:    Check the alternative corresponding to the result of executing the main method of the Java program presented below: public class A { public void ml(){ mx(); } public static void mai...
asked by 02.02.2017 / 10:47
2
answers

Constants of non-primitive types

In Java, constants are declared with the sequences of keywords static and final . When we have public static final int UM = 1; "it makes sense" to call constant, since your value can not be changed. Now, speaking of...
asked by 26.07.2017 / 18:31
4
answers

How to concatenate two byte arrays in Java?

I have: byte mensagem[]; byte nonce[]; How do I concatenate the array nonce at the end of the array mensagem and store it in a third array?     
asked by 20.05.2015 / 23:09
3
answers

Transform SetInteger into SetString

I need to store a Set<Integer> within a sharedpreferences, but it only accepts Set<String> , can you do that conversion? Set<Integer> checados = group.getCheckedIds(); prefeditor.putString...
asked by 23.11.2017 / 23:27
3
answers

Replace part of a String in Java

I have Strings that repeat themselves, just changing a word. I have a case to mount the email content, but I do not want to repeat the entire string, and the only value that will be different is whether it is front-end, backend, mobile, e...
asked by 19.09.2017 / 05:06
2
answers

Delete files created more than 10 days ago, saving the most recent, if everyone on the list has more than 10 days of creation

I did this question where the question was how to delete files with more than 10 days of creation. I retrieve them from a directory and the code has already been implemented and is functional. However, I ended up with a problem that could c...
asked by 17.08.2016 / 20:31
2
answers

What is the name of the concept used in this code?

If I create for example two classes and put the Funcionario class with a Empregado variable in the Empresa class, what is the meaning of this and what is it for? class Funcionario { String nome; String cpf; } class...
asked by 18.07.2016 / 22:58
2
answers

How to know in JAVA that ResultSet result is empty?

I am searching the database, and I have problem with SQL returning an empty value. In fact it is possible that this happens and for this I must keep prepared for it. What method to identify that no record was found with that parameter?...
asked by 01.02.2016 / 12:08
2
answers

How hibernate.hbm2ddl.auto works?

What values can I use in this property? ex: Update <prop key="hibernate.hbm2ddl.auto">update</prop> How does it work? When should I use it? is it a good practice?     
asked by 05.10.2015 / 17:15