Questions tagged as 'java'

3
answers

What is the difference between checked and unchecked exceptions?

Hello! I have some doubts about exceptions, which are: What is the main difference between checked and unchecked exceptions? In what situations should I use each one? What are good usage practices?
asked by 27.03.2014 / 03:44
4
answers

Capture the JSON values that are Online

My problem: I need to read a JSON that is in a certain URL. I tried the following code, but it does not work: JSONObject jsonObjeto; JSONParser parser = new JSONParser(); URL url = new URL("http://www.exemplo.br/teste.json"); String x =...
asked by 18.02.2014 / 18:44
1
answer

Organize packages in a java project

When you create a project in Android , the IDE itself suggests that the main package has its own naming type (com.example.packagedname), and also creates an entire hierarchy of directories already defined. Just like in Android , i...
asked by 20.02.2016 / 13:07
4
answers

Infer class type from a generic

In the following class I want to assign the clazz attribute to the class type by inferring it from the list entered in the constructor. class Foo<T> { private Class<T> clazz; Foo(List<T> list) { //this...
asked by 09.06.2015 / 18:01
1
answer

Drawing Top Gear

I'm trying to make a game like Top Gear (SNES) to get a little bit of knowledge about 2D games, but I had a question about the clues: are they straight lines, curves or images? I'm using JavaFX. If I try to use curves ( QuadCurve ) it i...
asked by 21.09.2015 / 01:10
3
answers

How to calculate mathematical expressions in a string?

I'm making an application handle an expression. How do I calculate the result of an expression? For example: 3(-9)+50/2 . This expression is typed in TextView .     
asked by 19.02.2015 / 23:11
3
answers

What is the difference between the Statement and the PreparedStatement?

When I paid for the database chair, we only worked with the database, alone with no connection to an application that interacted externally with the DBMS. Only then was Java Database Connectivity (JDBC) introduced. But due to the rush of the cou...
asked by 21.11.2015 / 17:36
1
answer

What is the difference of Integer.valueOf () when using String or int parameters?

Why are the results of System.out different in the lines below? Integer teste = Integer.valueOf("0422"); Resultado: 422 Integer teste = Integer.valueOf(0422); Resultado: 274 If you pass a int it changes the original value, no...
asked by 17.09.2014 / 16:15
1
answer

How to generate an .apk file in Android Studio?

If it is already generated in which folder it is located?     
asked by 07.02.2015 / 23:55
2
answers

What is the difference of use between KeyPressed and ActionPerformed?

I made tests to see the difference in use, and apparently both of them fire by pressing ENTER on the keyboard, as can be seen in the example below: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.T...
asked by 30.08.2017 / 16:01