Questions tagged as 'java'

2
answers

End of entry Java Scanner

This code in C will read integers until you type Control-Z (end of entry in windows). void main(int argc, char *argv[]) { char line[100]; int sum = 0; while(scanf("%s", line) == 1) { sum += atoi(line); } printf("%...
asked by 03.04.2014 / 16:52
2
answers

How to pass an array to a JTexfield?

I'm doing a college job where we have to do a kind of login screen, however, with array and not Arraylist . My question is how do I pass information from JTexfield to array ? This array needs to have the funct...
asked by 28.10.2014 / 15:32
1
answer

Why does not the Matcher class return the number of groups correctly?

After the question " What is the difference of use between match () and find () methods of Matcher class? ", I continued testing this class to understand its operation, but I came across a strange behavior. When trying to identify the number...
asked by 03.10.2017 / 01:08
1
answer

How to cut part of a bitmap?

I want to create a Bitmap that its content is a part of another Bitmap For example: I have a Bitmap of (400x900) width = 400 height = 900 I want to trim it in dimensions (400x400) in order to leave the height equal to...
asked by 04.10.2017 / 21:06
1
answer

When and why to use a parameterized constructor?

I'm very confused. I wonder if it is better to use the pattern and setters to assign a value to the attribute, or whether it is better to assign the values to the attributes via the parameterized constructors and use the setters to change their...
asked by 14.10.2017 / 06:26
3
answers

Error in MergeSort sorting algorithm in Java

I was doing the MergeSort sorting algorithm in Java for study purposes and every time it runs it gives error. I have already reviewed the logic of the algorithm, I already replace the array of integers with a ArrayList , I already tried to...
asked by 20.03.2018 / 20:55
2
answers

Lambda in Java 8 launching Exception

I have the following problem. I need to perform a process of updating the user and his group, and to make the change I search the user, validating if it exists and soon after, I look for the group checking if it exists, if any mistake happens...
asked by 27.03.2018 / 23:48
2
answers

Help with regex in Java - sequence of numbers separated by commas

I'm breaking my head to put together a regular expression that validates the String: /aluno/1/Teste dos Testes/1,2,3 String reg = "/aluno/[0-9]+/[^0-9]+/......." I'm not able to validate the last field (the sequence of numbers)...
asked by 22.04.2018 / 03:15
1
answer

Conflict with MBean name when uploading two Spring Boot applications on the same Tomcat

I have two applications in Spring Boot that use a common nomenclature for beans . In this case, my pool of connections to the database is managed by HikariCP. Due to an infrastructure problem, I had to upload two of my Spring Boot projects...
asked by 18.04.2018 / 22:17
1
answer

Save a TextView value and add another

I'm creating a keyboard to add value to a TextView. I was able to add a value only to TextView. But what I wanted to do was to keep the current value and add another one to the side so that the user would make a number to add to TextView. In...
asked by 18.05.2018 / 15:49