Questions tagged as 'java'

5
answers

Digits in a java string

How do I find out how many digits a String has in Java? For example, user entered with "example123", the string has 3 digits. I am using this function but it is not working: private static int digitos(String text) { char[] digitos = ne...
asked by 24.05.2017 / 00:49
2
answers

Can a subclass have two superclasses?

Suppose I have a Pessoa superclass and another Funcionário , with its given attributes and methods. Can my Professor class be a "daughter" of Pessoa and Funcionário , since it fits both? If yes how is it possible? With...
asked by 27.02.2018 / 13:37
2
answers

Error replacing occurrence in string using replaceAll

I extract the text of several lines of a PDF, at the beginning of each line I have a configuration of the font size and family used in that line, but then I need to remove this information. First I made using replace , as follows: Str...
asked by 11.10.2015 / 03:53
2
answers

Open PDF in java on another machine

I made a function that I can open a PDF, but this function is only working on my local machine. When I run the .jar generated on another machine, an error is issued that the PDF file does not exist. The part that performs this function: tr...
asked by 25.11.2015 / 11:14
1
answer

Problem in entity creation with one-to-one relationship

I created a test project, and I'm studying entity creation with relationships, and in that I created two entities with this relationship below: Iamabletocreatetheentity,butnotintherightway,usingthisclassbelow:packagebr.com.softplan.jpa;impo...
asked by 11.09.2015 / 18:40
3
answers

How to display a multidimensional array without using a loop?

When trying to execute the following snippet: int[] vetor = {1, 2, 3, 4, 5, 6}; System.out.println(Arrays.toString(vetor)); The array is normally displayed as [1, 2, 3, 4, 5, 6] but if I try with a two-dimensional array, as follows:...
asked by 14.01.2017 / 14:28
2
answers

Formatting a double in java

I would like to know how to keep the variable double with 2 houses after the comma. Below I have an example, when transforming a String into double if it has values after the point is kept the 2 houses, however if it is only...
asked by 28.08.2014 / 20:16
1
answer

Unique key violated when I am doing a delete. Because?

I have a problem that seems silly but I'm skating and I can not solve it. I have a legal application made in Java using JPA 2 with Spring, Spring Data, JSF, etc ... It works very well. The base I'm using is Oracle 10g. Well now comes the prob...
asked by 06.06.2014 / 00:39
1
answer

Spring MVC + Joda Time + @DateTimeFormat

Description: Spring does not convert using @DateTimeFormat , I try to send start both ways below and it returns me a 404 . When I send the object without this field it creates the normal object, but it can not create whe...
asked by 21.02.2014 / 19:43
2
answers

EntityManager with JTA multiple connections

I'm having a rather unusual problem, but I'm looking for a solution. I have a scenario where I have several database bases (postgresql) allocated on multiple clients, all databases have the same structure, but with different records. I hav...
asked by 19.09.2014 / 19:33