Questions tagged as 'java'

4
answers

Check if String is number, if not, return error to user

I'm doing a Java code using JOptionPane, and in it, I created an InputDialog that returns the value "1", "2" or "3" entered by the user to a String variable called "return". That done, I need to convert it to int, using Integer.parseInt()...
asked by 30.11.2015 / 17:55
1
answer

How to run DOS command in JAVA with Administrator privilege?

Hello, I have a program where I need every run of it, go to the server, pick date and time, and change it on the local PC. I am running the following command line: Runtime.getRuntime().exec('DATE '+dataServidor.trim()); and JAVA returns...
asked by 24.11.2017 / 14:47
1
answer

JavaFX reality or just speculation? [closed]

I have experience in Swing for 8 years, but some time I've been reading that with Java 9 Swing will be totally abandoned by Oracle. Now the need arose for me to develop a Desktop system for a client and I had some doubts. My doubts are as fol...
asked by 18.02.2016 / 20:40
3
answers

Method String.equals and NullPointerException

Although the doubt is very basic, I would like to understand why equals in this case: String texto = null; System.out.println("teste".equals(texto)); Return false normally (example in ideone ), but in the example bel...
asked by 22.03.2016 / 15:57
2
answers

Simple split equation in java

Good afternoon, I'm a beginner in Java and I need to do the following calculation in the language For example: (8/7) * 100 = 114% (4/7) * 100 = 57.14% (90/112) * 100 = 80.35% But the way I'm developing it does not return the correct...
asked by 13.06.2016 / 21:04
2
answers

Problem with ArrayList

I'm learning about Array and I'm breaking my head with this code, can anyone explain why it's not working? This error appears    The type List is not generic; it can not be parameterized with   arguments in this line List<Integer...
asked by 29.09.2015 / 14:54
4
answers

How to validate a standard EAN 13 barcode?

I would like to know how to validate a standard bar code EAN 13 like this 9788576356127 , this code has 13 digits and the criteria for validation are: Perform the checker digit calculation; Verify that the bar code has 13...
asked by 05.03.2016 / 17:58
3
answers

Email Verification in Java

I am doing a simple test to verify that the user has typed a valid email. So I'm having a syntax error in the "@" invalid AssignmentOperator. Main class code: public class Email { static String email = "[email protected]"; public stati...
asked by 09.06.2015 / 14:19
3
answers

Placing a vector in descending order

I need to create a vector of size N but it has to be ordered decreasing only when I make the code always 0. public int[] vetor_dec (int n) { int[]vetor = new int[n]; for(int i=n;i>vetor.length;i--) { int aux=0; veto...
asked by 17.09.2014 / 15:15
3
answers

Random without repetition

Well I have a question that is killing me already has time, and I can not solve. PS: I'm a beginner on Android. I'm developing a lottery application, but I can not generate a Random without repeating the numbers already drawn, I've tried ever...
asked by 11.10.2017 / 16:10