Questions tagged as 'java'

1
answer

Using Java synchronized

I was doing some exercises in Java, and I came across this code below in an issue, stating that "The implementation of the doLog method of the Escritor class should be qualified as synchronized ". How do I qualify the meth...
asked by 06.10.2017 / 21:32
1
answer

Reason for IncompatibleClassChangeError

Recently I noticed some error messages in my code, the message that appears is this:    Exception in thread "Thread-3" java.lang.IncompatibleClassChangeError The strange thing is that it only happens with jar ready and on other mac...
asked by 10.10.2017 / 21:06
2
answers

Pick programmatically generated EditText values

I have an APP, which preencho a quantidade de jogadores will have the championship and I click on a botão to create the championship. This button plays for a activity that takes the amount that was set and gera N EditText...
asked by 04.10.2017 / 20:44
1
answer

How does content-type work in java?

I saw a video of a guy using the connection.setRequestProperty("content-type", "aplication/x-www-urlencoded"); But I did not understand how it works, especially "aplication/x-www-urlencoded" .     
asked by 07.10.2017 / 03:35
1
answer

Loop "for" counted odd number, even and averaging

I need to make a code that: List a number of numbers Inform if they are divisible by 3 and 5 If they are even or odd And then take the separate mean of each (average of odd and average pairs) I made a code, but when it does the aver...
asked by 03.10.2017 / 04:23
1
answer

Scanner is not picking up all lines

I have a file with 7 million lines, but my code takes a maximum of 63000 and does not return any error. Scanner sc2 = null; try { sc2 = new Scanner(new File("./assets/words.txt")); } catch (FileNotFoundException e) { e....
asked by 27.07.2017 / 20:06
2
answers

Advantage of nulling a variable in Android

Assigning the value of null to a variable in Android can improve application performance? As far as I know, in Java we have the Garbage Collector, and on Android the activity cycle of Activities and Fragments. Problem: In a cla...
asked by 27.07.2017 / 14:05
1
answer

How to use LOGGER in java

I configured Logger in my main class. public static final Logger LOGGER = Logger.getLogger(DashBoard.class.getName()); and I'm using it this way: LOGGER.log(Level.SEVERE, "Error occur in FileHandler.", exception); But now I want...
asked by 08.02.2018 / 11:14
2
answers

Doubt between blocks and statement

On this question, what would be the right answer?    How many statements are there in the code below? Warning: This is a   tricky one. The code is valid. { println("Step 2"); { println("Step 2a"); { println("Step 2a.1"); { } }...
asked by 19.10.2017 / 01:49
2
answers

How to pass a float without loss of value to an integer?

I have a float variable that can contain any number in it, I need to test if it fits an integer without losing values. I thought about using some test to see if the numbers after the comma are 0's or not. Does anyone know how?     
asked by 17.07.2017 / 22:50