Questions tagged as 'java'

2
answers

Alternative to the Scanner for data entry

In Java, when we are learning to capture data entry, usually by text mode, we are instructed to use the class Scanner . Is there any alternative to Scanner to capture data entry by text mode? If so, how does it work?     
asked by 21.02.2016 / 14:37
3
answers

How to check if a LocalDate is a weekend?

I have the following date of type LocalDate 2017-12-21 How do I check if it's a weekend? I tried to use Calendar , but it seems to only work with Date .     
asked by 22.12.2017 / 02:52
2
answers

What are functional interfaces?

What are functional interfaces in Java? Has this concept already existed or came out of version 8 of Java?     
asked by 31.03.2014 / 21:02
2
answers

Pick up current machine date

I need when I run the code it takes the current date of the system and assigns a Date . Example: Date x = new Date(now);     
asked by 21.10.2015 / 07:39
2
answers

Best way to use and Instantiate the EntityManagerFactory

My project has the following structure: Withinthebr.mandacaru.DAOpackagearethecontrollers.ToinstantiateaJPAControllerobjectIneedaEntityManagerFactoryobjectandforthisreasonIcreatedaEntityManagerProviderclassthathasagetEntityManagerFactorymetho...
asked by 03.01.2015 / 18:10
1
answer

Javac is not recognized as internal or external command [closed]

I'm trying to compile a class in java via the command line (cmd), however I can not, the error shown is:    'java is not recognized as an internal or external command, operable program or batch file. Image of the prompt with the error:...
asked by 12.09.2015 / 20:47
1
answer

What are the differences between HashMap and Hashtable?

What are the differences between HashMap and Hashtable in Java? Which is more efficient?     
asked by 25.08.2015 / 21:20
3
answers

How to find the occurrence of equal integer values in a vector?

I need to find age frequency in a vector. I know how to do this when the vector is small, but not when it is large. Consider the following vector: int[] idade = {15,18,15,20,16,30,18,45,43,14,25,16,20}; For this vector, I could do a sequent...
asked by 06.09.2018 / 07:37
2
answers

printf in Java - What is% 3d for?

I'm seeing a java arrays exercise, but I can not figure out what the %3d is, if it's a int . for (i=0; i<n; i++) { System.out.printf("a[%d] = %3d b[%d] = %3d\n", i, a[i], i, b[i]); }     
asked by 12.02.2016 / 18:25
2
answers

Invoke method of an object - reflect

Is it possible to invoke a method from a content of a String variable? for (Object vlr : dados) { String metodo = "getCodigo()"; contato.setAttribute("codigo", vlr.metodo); }     
asked by 24.09.2015 / 20:15