Questions tagged as 'java'

1
answer

Importing the java.lang package. *

Adding Java studies I came across a special package, java.lang , where the author of the book mentions that we do not need to import of this package.    There is a package   special in the Java world called java.lang. This packag...
asked by 25.12.2018 / 01:35
1
answer

How does a form's data capture work?

I have this code to get data from a form: @WebServlet(name = "computador", urlPatterns = {"/computador"}) public class computador extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse re...
asked by 08.02.2016 / 17:45
2
answers

Performance difference between several conditions in an IF or multiple IF's separately?

During a change in a source code, I came across the following situation, developed by another developer: if ( booleano1 || booleano2 || booleano3 ) { if( booleano1 ) { //faz algo } if( booleano2 ) { //faz a...
asked by 03.12.2015 / 12:54
1
answer

Is there an associative array type data structure in Java?

Well, I'm trying to name an Array of Strings in Java, but I wanted it to be, for example: String[] symbols; And that could be stated like this: symbols["name"] = "Tiago"; I know that Array does not exist like this, but in some other wa...
asked by 13.01.2015 / 22:10
2
answers

How to detect USB connection via application?

Is it possible for me to detect a USB connection in my Android application and how do I do this? I have a sync menu that is performed via USB and FTP, however I want to leave the USB option accessible only when the device is connected to the...
asked by 29.12.2014 / 15:11
2
answers

Demoiselle JUnit - NullPointerException

When running a unit test with br.gov.frameworkdemoiselle.junit.DemoiselleRunner , the following error is occurring at the end of the test run: java.lang.NullPointerException at br.gov.frameworkdemoiselle.internal.bootstrap.SeBootstr...
asked by 22.02.2015 / 16:18
2
answers

Questions about DAO, MVC, Multiple Tables and POJO

If someone can help me, I have a question that has been consuming me a lot in recent days and is psychologically locking my studies (hehehhe) MVC and DAO with multiple tables. I will put here a model, an idea and then evolve my doubts: We ima...
asked by 30.11.2015 / 20:45
2
answers

Java 8 "default method" versus C # "extend method"

Java 8 introduces the concept of "standard method" to allow adding new functionality to an interface. C # provides "extension methods" that allow you to "add" methods (features) to existing types. Considering how they are implemented by th...
asked by 02.04.2016 / 01:05
2
answers

Manipulating String in Java

I have text inside a String. I'll go through this String. As I go through it, I must take every word it contains. I thought about using string.split(" "); but I need to treat. "" ";" "," ":" "!" "?" among other cases. How can I do this?...
asked by 05.08.2014 / 15:17
1
answer

Why does the compiler create repeated .class files?

I have noticed that when the java compiler compiles some class that has some swing / awt component, it creates another or even several classes of the same name, with a $ followed by a numbering. I made a simple code to check if it was...
asked by 28.06.2016 / 20:15