Questions tagged as 'java'

2
answers

Java DTO with Spring Boot 2

I'm trying to implement DTO and am having a sizeable headache. I'd like some help. Here is my project, with spring boot 2. I have 3 tables @entity as follows. Abstract Client with only 1 attribute, the "id" and the respective get and set....
asked by 19.06.2018 / 06:39
1
answer

Doubt over Recursion in a power method

I did not understand how recursion works in the method that performs potentiation. public class calculaPotencia { static Scanner scan = new Scanner(System.in); public static void main(String[] args) { System.out.print("digite...
asked by 05.06.2018 / 01:43
1
answer

More than one list in the same loop

Can I put more than one list in the same loop ? for example, you can put more than one variable in for : for (int a, b; a<10 b<20; a++ b++) { ....... } Then I wanted to put more than one list in the same foreach : fo...
asked by 24.03.2018 / 22:17
3
answers

I am not able to register data in the database

I'm a beginner in Java and I have the following problem. In the status register screen, I have a country selectOneMenu, and two fields for name and acronym. When I save in the database I get the following error: Console: 2018-05-24 01:16...
asked by 24.05.2018 / 06:51
2
answers

Is it worth measuring performance between Java x Kotlin application?

By moving to the Google Developers documentation, I found something really cool like: Measuring app performance with Android Profiler But knowing that Java and Kotlin are interpreted by the JVM, I believe that the difference in performance...
asked by 23.05.2018 / 01:23
2
answers

How to call a method when its parameter is an array?

I'm new to java and I'm having a hard time calling a method, well, I have this: class main { public static void main(String[] args) { vetorFloat(vetor[x]); } private float vetorFloat(float[] vetor) { //algum código...
asked by 28.03.2014 / 01:47
2
answers

Recursive function in Java to calculate: e = 1 + 2/1 + 3/2 + 4/3 + 5/4 + ... + n / (n-1)

My code: /** * Funcao para calcular: e = 1 + 2/1 + 3/2 + 4/3 + 5/4 + ... + n/(n-1) * * @param termos - quantidade de termos do somatorio * * Teste: * para termos = 4 * soma = 1 + 2 + 1.5 + 1.33... * so...
asked by 23.09.2018 / 07:21
1
answer

Modifier of access "private" in TypeScript

In most of the examples I encounter in TypeScript, I see that the attributes of the class do not use the private access modifier. Is it a matter of design or is there any difference in how Java works? export class Aluno { codigo:n...
asked by 23.11.2018 / 10:42
1
answer

"break" inside a chained if-else

I'm new here and I have a very simple question: is there any kind of " break " so that it can be used within a if-else chained? if (valor > getSaldo()) { System.out.println("Valor informado maior que o saldo"); } else {...
asked by 09.03.2018 / 14:36
2
answers

How to program according to good OO design practices? [closed]

I did this program, simple and nothing complicated. My problem is that even though I'm doing exactly what I want, it does not follow correct patterns of object-oriented design. What should I do to, for example, wipe out static variables, extends...
asked by 13.03.2018 / 16:32