Questions tagged as 'java'

1
answer

Error "Can not make static reference to the non-static faithful

I'm doing an exercise with a class Carro and subclasses Familiar Citadino and Jipe ... Only when doing a class Testabuzinar1 that instantiates each of the subclasses and then calls the method honk (which is in...
asked by 08.04.2017 / 16:13
1
answer

JsonFormat changing date in a get request

I have a web service in java using Spring Boot, in a class I have an attribute of type date and I use JsonFormat to format the date and be able to convert on the client side, using Gson. However, even setting the locale for the zone of Brazil, w...
asked by 09.04.2017 / 01:09
2
answers

Use of enum in the cases of a switch

Hello, good afternoon. I have a problem with using ENUM to replace a number in the case. In order to make my code more intuitive and do not use numbers in switch cases, I intend to use an ENUM in their place. Example: private static enum En...
asked by 03.03.2017 / 18:31
1
answer

nullException when setting bank data as parameter

I'm trying to bring the data from the database with this method from my DAO class: public List<Transacoes> listDBPF(){ Connection con = new ConnectionFactory().getConnection(); ResultSet res; List<Transacoes> arrTrans...
asked by 21.05.2017 / 02:17
1
answer

HTTP Error Status 405 Servlet

I've been doing the "5.5 First Servlet" exercise on Caelum's Java Web FJ21 handout, I made the code, restarted Tomcat as requested but when I open the link "http: // localhost: 8080 / fj21-agenda / oi "> link " to access the page the error occur...
asked by 21.05.2017 / 16:35
2
answers

Insert data when creating SQLite table

In my database I have a State and Cities table, I would like to insert this data once the app is installed, ie when creating the database, these records are already inserted in the tables at once. I made the following code but is inserting only...
asked by 19.05.2017 / 02:28
1
answer

How to pass data between Activities [duplicate]

I have a code that transforms getText into string and would like to pass this string to another activity in a simple way, but not an activity coming soon after that. My code: @Override protected void onCreate(Bundle...
asked by 18.05.2017 / 20:18
1
answer

Add financial balance with Jtable

I'm trying to develop a Java sales control program, but I'm having a problem scheduling Jtable's balance. As you can see in the image below, the balance is being updated per line. However, since I declare the initial balance equal to 0, I nee...
asked by 20.05.2017 / 18:10
2
answers

JDBC, query returns false but saves in bank

I'm running the following function in java: public boolean insert(User user) throws SQLException{ String sql = "insert into usuarios (nome, email, senha) values (?,?,?)"; PreparedStatement instruction = this.connection.prepareS...
asked by 11.05.2017 / 15:53
1
answer

Admin permission to run netsh in java

In a java program I developed, I need to open a connection on port 21 (ftp), but Windows 7 by default blocks this port. I tried to add a rule in the firewall allowing the connection using Runtime.getRuntime (). Exec ("netsh ..."), but netsh need...
asked by 12.05.2017 / 02:40