Questions tagged as 'java'

2
answers

Multi-core CPUs - Why does not my application use all processor cores?

I have a question that I can not find a convincing answer. There is an application developed in Delphi 7, and in an extremely complex routine (which takes about 2 hours) we noticed that only the first processor core is used, in this case an I...
asked by 23.06.2015 / 21:06
4
answers

What is the difference between - = e = -?

In java and other languages I have seen in some projects things like: saldo -= 100 and sometimes saldo =- 100 , but I could never understand the difference between these two types, if there is any difference. After all,...
asked by 13.03.2018 / 15:51
5
answers

Difference between private and final methods

Studying final methods and classes in the book "Programming in Java 6 ed." of Deitel I came across the following proposition:    The methods declared private are implicitly final, because it is impossible to overwrite them in a subclass (alt...
asked by 30.11.2015 / 12:22
1
answer

HTTP Cache Headers in Servlets

I would like to know if there are libraries or solutions to handle requests containing headers such as Last-Modified , If-Modified-Since , If-Range If-None-Match , etc. and produce replies with Cache-Control ,...
asked by 24.12.2013 / 19:34
4
answers

How to use SimpleDateFormat in competing environments?

The class SimpleDateFormat is not thread safe . I recently had problems with instances of class SimpleDateFormat in static context being used by multiple threads concurrently in a web application. private static final DateForm...
asked by 11.12.2013 / 20:55
4
answers

Behavior of the different forms of comparison in Java

If for example I have the code below, I'm comparing the object reference in the ex1 and ex2 case and not the object itself, correct? Pessoa ex1 = new Pessoa(); Pessoa ex2 = new Pessoa(); if(ex1 == ex2) { System.out.println("I...
asked by 01.10.2014 / 19:27
2
answers

What is upcasting and downcasting in the Java language?

What would be downcasting and upcasting in Java? Examples please.     
asked by 29.05.2016 / 02:46
3
answers

Avoiding comparison "! = null" in Java

I work with Java and for countless times I have to do a test object != null on the object before accessing it to avoid NullPointerException However, I think this practice ends up making the code very ugly, dirty and hard to read....
asked by 06.02.2014 / 11:38
2
answers

Why does not polymorphism work with Generics?

When trying to compile the following code I got an error. import java.util.*; class Animal { } class Cachorro extends Animal { } public class TestePoli { public static void main(String[] args) { List<Animal> cachorros = new A...
asked by 10.03.2014 / 00:06
1
answer

How does Spliterator work in Java 8?

In Java 8 (which was released in March 2014), there is a new interface called Spliterator . It has a similar purpose to the Iterator , but it is designed to perform iterations in parallel . However, even after reading a lot about this inter...
asked by 16.12.2013 / 05:30