Questions tagged as 'java'

2
answers

How to validate if a text field is numeric in Java?

How to validate if a text field is numeric in Java? I have validations for textfields that receive Strings, and it warns me when it's empty. boolean Valida(){ if(txtRFC.getText().equals("")){ javax.swing.JOptionPane.showMessageDial...
asked by 06.06.2018 / 22:46
1
answer

How to provide USES_POLICY_FORCE_LOCK permissions in Android Studio?

I have an application that should block the device after a certain time, I found that it can be done with the lockNow() instruction, but when I put it and execute it, I get the following error.    E / AndroidRuntime: FATAL EXCEPTION: T...
asked by 17.09.2018 / 23:42
1
answer

Java - Bug in while loop using newLine Scanner

I am creating a text adventure, and I have a while loop (game loop) in which an action is requested from the user, of which are: Explore, Move, Take, Inventory and Position. And user information is received using the Scanner class. To make it...
asked by 20.03.2018 / 12:09
3
answers

Compare elements of an array to find the greatest

In the following code I need to enter two car identifiers per Scanner and show me which is the car that has traveled the most kilometers. How could it be done? import java.util.Scanner; public class Pruebas { public static void m...
asked by 12.01.2018 / 21:00
1
answer

Grant value byte in a set

We have a DB with a User table that has a column of type Tinyint (Since it is a boolean) and we are working with Hibernate. My User model has a variable, autogenerated, Byte type to designate that user value (setters & getters). The fact is t...
asked by 20.04.2018 / 10:24
1
answer

How to exchange a larger number with a smaller number and vice versa?

I have problems with a programming fundamentals exercise that asks me to enter n numbers to a vector and exchange the largest number in the position of the smallest number and vice versa and then show it int a[]; int ta; int m...
asked by 06.04.2018 / 04:44
2
answers

control simultaneous calls to a REST service without duplicating the ID in JAVA

I'm doing a REST service through Spring and swagger with CMIS protocol. my service works well until the moment I make simultaneous calls through Jmeter to be able to stress the system. Context: the service obtains the ID from an ID creator to ge...
asked by 04.04.2018 / 15:39
1
answer

Algorithm binary search (Based on divide and conquer) does not search well in a matrix

Good, I have created a code based on binary search, which makes recursive calls to find an Integer that is passed as a parameter (element). The problem is that when it comes to testing it (making it look for all the numbers contained in a matrix...
asked by 06.10.2017 / 10:39
1
answer

Sending an image by WhatsApp

I want to send an image by whatsapp to a specific phone number without having to access the image gallery and within the contact's chat. Now what I do is the following: Intent intent = new intent(); intent.setaction(Intent.ACTION_SE...
asked by 20.06.2017 / 09:13
1
answer

JPA problems persisting cascading a subclass

I have the following classes @Entity @Table(name = "personas") @Inheritance(strategy = InheritanceType.JOINED) @ClassExtractor(PersonExtractor.class) abstract public class Persona implements AbstractEntity<Long>, Serializable { privat...
asked by 02.03.2018 / 00:17