Questions tagged as 'java'

2
answers

How to retrieve the return result of a routine from within a Thread?

I need to run a routine inside a Thread, and get the return of this method. My code is this way. class Main { public static void main(String[] args) { String resultado = ""; Thread t = new Thread() { @Override...
asked by 03.07.2015 / 12:39
2
answers

How important is the use of interfaces in Java or C #? [duplicate]

I know how to implement and use the interfaces, but I can not understand why they exist in C # or Java, since once you extend your class to an interface you need to implement all methods of the interface.     
asked by 23.07.2016 / 01:14
1
answer

Format CPF or CNPJ field using Regex [duplicate]

I would like a regular expression (REGEX) to format the CPF or CNPJ field This is the code I've come so far: String cpf ="09551130401"; cpf = cpf.replaceAll("(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})", "$1.$2.$3-$4"); System.out.pri...
asked by 07.06.2016 / 13:58
2
answers

Customize error message

I forced an error on my system that contains the following message:    javax.persistence.PersistenceException:   org.hibernate.exception.ConstraintViolationException: could not   execute statement It is a constraint violation. How can I c...
asked by 09.06.2016 / 22:20
1
answer

Entitiy framework for JAVA?

Good night guys, I'm new to programming. So, I've been looking at some articles and watching videos about the Entity Framework for C #, I wonder if there are any frameworks in Java that do the same or similar function in relation to CRUD?     
asked by 17.10.2018 / 03:48
2
answers

Java variable declaration

There is some difference between the two statements: First: int a; int b; Second: int a, b; Which is better? Do variables get closer in memory or is this just myth? Is there any significant difference?     
asked by 05.10.2018 / 14:04
2
answers

How to open an activity from a java notification in android?

How to open an activity by clicking on the notification. The detail is that I want it to reopen even if it is open in order to update the data of it. I'm using: int icon = R.drawable.ic_launcher; long when = System.currentTimeMillis();...
asked by 22.02.2015 / 22:08
2
answers

Difference between private static final and private final for the use of immutability

An attribute when declared with the static modifier has the characteristic of "propagating its value" for all instances of the class to which it belongs, ie its value will be the same for all instances. Because of this feature these attribute...
asked by 22.01.2015 / 21:13
2
answers

Change the label color of a chart in PrimeFaces

I have a graph and the labels that are on the x axis are very dark color and I would like to change this color, I already tried to change the color property of the graph, but only the title changes. <p:chart type="bar" model="#{graf...
asked by 20.07.2015 / 18:46
1
answer

How to structure the hibernate Entity relationship annotations?

I would like to understand the difference between hibernate annotations with JPA: @OneToOne, @OneToMany, @ManyToMany and @ManyToOne of hibernate, how does it work?     
asked by 22.07.2015 / 18:59