Questions tagged as 'java'

2
answers

Hide the keyboard

As soon as the user clicks on one of the EditText of my Android application, the keyboard appears, however, it does not disappear when it finishes typing and clicks off of it. I would like to know which method would be appropriate, kno...
asked by 14.05.2014 / 16:20
2
answers

Retrieve the first elements of an Integer list

I have a list ArrayList<Integer> list = new ArrayList<Integer>(); where I have over 40,000 records. I wonder if you have a way to get only the top 10,000. I know you have to for and move to a new list, but this requires...
asked by 16.02.2016 / 17:59
2
answers

Switch case Java ends for no reason

I have an example of switch-case with 8 options. However from case 7 it ends the program. It was for him to go back to the menu option after running. Does case have options limit? Follow the code: import java.util.Scann...
asked by 12.08.2016 / 14:59
2
answers

What is the purpose of the default when used in the signature of a method?

Within the List<E> interface of Java there is the replaceAll() method whose purpose is to replace all occurrences of a specified value in a list. However, in your signature it uses the command default , this has conf...
asked by 08.03.2016 / 22:04
2
answers

How to compare the contents of two vectors?

public class VetorTurma { public static void main(String[] args) { int pontuacao = 0,nota,c; String nome; Scanner sc = new Scanner(System.in); double gabaritoVetor[] = new double[10];...
asked by 14.02.2016 / 02:35
2
answers

consume REST service with totalcross

I would like to know how to consume a REST service using totalcross. I made an example following what is in the documentation, I am using HttpStream. String url = enderecoWS + servico; HttpStream hs = new HttpStream(new URI(url)); byte[] bu...
asked by 22.03.2017 / 13:53
2
answers

How to transform String from time to an integer?

Example, I get a String with the time of day "16:20". The day has 1440 minutes. How to know in what interval from zero to 1440 is this time? An integer value.     
asked by 30.03.2017 / 04:24
1
answer

Good practice with Java exception handling

What is the best way to work with more than one exception in Java? In the code below, I see the possibility of giving two errors NullPointer or SQLException . If I put a catch for each exception is the best way? public B...
asked by 25.02.2017 / 00:13
2
answers

Execution of programs in halt WITHOUT use of Threads

Ask me to build a Java program that runs parallel programs ( ls , firefox ) that are contained in a file. I already have the following code: File file = new File()'; List<String> lista = file.readFile(args[0]);...
asked by 21.11.2017 / 13:32
2
answers

Treat ArithmeticException in another method

I want to create a split method (double a, double b) that has try / catch to get the Arithmetic Exception, returning an error message by System.out.println; as it is not in the main method, I do not know how it has to be the signature of the met...
asked by 24.08.2015 / 19:26