Questions tagged as 'java'

2
answers

Operator in in java

I'm learning Java and I came across the need for the in operator. For example: I have a vector ( v = {1,2,3,4,6} ) and I want to see if the 5 is in this vector (not in this case). In python it would be v = [1,2,3,4,6] -...
asked by 10.09.2017 / 03:15
2
answers

JUnit 5 - How to run a test method only if another test method passes?

It would look something like this: @Test void metodo1() { assertTrue(...); } @Test void metodo2() { //Deve ser executado após método1(), e SOMENTE SE metodo1() passou! assertTrue(...); } I need to do this for cases where it does not ma...
asked by 24.02.2018 / 19:52
3
answers

Is it possible to create a MAP within another MAP?

Is it possible to create a MAP<> within another MAP<> ? type this code: private Map<String, Map<String,Object>> mapTESTE = new HashMap<String, Map<String,Object>>(); If yes: How do I...
asked by 28.07.2014 / 15:32
3
answers

Difference in the practice of arithmetic and assignment operators

package entities; public class Product { public String name; public double price; public int quantity; public double totalValueInStock() { return price * quantity; } public void addProducts(int quant...
asked by 11.12.2018 / 01:22
2
answers

Is there a difference in how the polymorphism in Java and C # is applied?

I'm studying the concepts of OOP and it gave me a question. In Java I believe I can access all methods and attributes declared as public in a subclass even when I use a superclass type variable to reference this subclass. But in C # I can...
asked by 31.05.2017 / 19:09
2
answers

Understand error message

I can not understand this error message. Does anyone understand and can you help me? Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3210) at java.util.Arrays.copyOf(Arrays.java:31...
asked by 28.06.2017 / 16:50
2
answers

The operator! = is undefined for the argument type (s)

I am trying to create a method to save users in the database by doing the following check if the id of the last user is different from null it changes if it does not register. Code public void salvar(Usuario usuario){...
asked by 28.03.2016 / 20:48
2
answers

What is it and what is the function. (dot) in OOP?

A long time ago a teacher defined and explained the function of . in POO (Java Classroom). In time I forgot, but I found it quite interesting, we often think it's just a "dot", but it's not quite like that. So the question:...
asked by 24.02.2016 / 13:36
2
answers

Save multiple instances of a class to a List in Java

I'm having a college assignment that I need to create multiple instances of a Pessoa object and save those instances to a listing to show the user when needed (this will work as a database). As we have not seen database I still can not insert t...
asked by 18.04.2016 / 03:59
4
answers

Error when executing hibernate

After catching a little, I'm walking with my project. When I run the project, I get the following error: mai 16, 2016 6:41:22 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation INFO: HHH000204: Processing PersistenceUni...
asked by 17.05.2016 / 02:44