Questions tagged as 'java'

3
answers

Assign value to the variable in the method declaration

Is it possible to assign the default value of a variable within the method declaration, the same as in PHP ? If so, how? Ex: I want the test function, when called, if no parameter is passed, has the value of b false and true...
asked by 19.10.2016 / 15:45
4
answers

Print variable within a repeat structure

You are not recognizing the variable soma because it is inside the loop . What do I do to fix this? public static void main(String[] args) { int tipo; int restante = 0; int bim = 4; //double soma= 0; double[] not...
asked by 29.08.2018 / 15:47
1
answer

How to convert a list of strings to a list of integers

I have TXT file, and it looks like this: 01 02 03; 01 02 04; 01 03 04; 02 03 04; Well, I load this file into ArrayList<String> as it is in the code below. How do I pass it to ArrayList<Integer> , to manipulate its...
asked by 24.08.2018 / 19:51
4
answers

Using auto reference

On the use of auto reference this wanted to know what difference to make: public static class Aluno{ private String nome; public String getNome(){ return nome; } public Aluno(){ this.nome="abc"; } }...
asked by 18.01.2017 / 12:33
1
answer

Optimistic Lock; Why not throw an exception?

I tried to simulate an optimistic Lock situation where you try to update the same record twice, but the exception is not triggered. I think it's interesting that even after changing the value of the holder and giving a MERGE, the version valu...
asked by 28.02.2017 / 21:25
1
answer

Can I call a method when the application is closed?

What happens when the user closes the application without calling a pre-defined method in the app, what I mean is when it removes the app from the list of active applications. What happens at the moment?     
asked by 20.03.2017 / 04:08
2
answers

How to add contiguous numbers to an array?

I have array of numbers being typed by the user, and I need to add the numbers of this array . import java.util.ArrayList; import java.util.Scanner; public class Questao3 { /*3.Fazer um algoritmo que: •Leia um número indeterminad...
asked by 07.01.2015 / 19:42
1
answer

How to create string vectors in java?

   "Make an algorithm to receive an integer n (number of students), an integer m (number of subjects), and nxm grades 0 to 10, which each student obtained in each discipline.       a) which (s) of course (s) students scored highest on average?  ...
asked by 29.11.2014 / 20:45
2
answers

How to return the position of an element in HashSet?

I have the following structure: HashSet<Contato> contatos = new HashSet<Contato>(); How to return the position of a given Contact element that is contained in HashSet? I was searching and found a way to get back to the po...
asked by 08.10.2014 / 23:58
3
answers

How to ensure that the person who used the system is really it?

At the university where we are studying, we are developing a Java EE system to debure some of the registration processes, extinguish forms and generate PDF forms that instead of literally passing by hand, will pass through person in person. Firs...
asked by 15.11.2014 / 05:46