Questions tagged as 'java'

2
answers

Is it better to parameterize your PreparedStatement even if the value is fixed?

I always read the blog Java Revisited and I was reading the article today Why use PreparedStatement in Java JDBC - Example Tutorial . At one point the author talks about parameterization of queries, it is better, safer and more performative to...
asked by 14.02.2014 / 19:25
2
answers

Curiosity about equality of Integers

Why System.out.println(Integer.valueOf("0")==Integer.valueOf("0")); System.out.println(Integer.valueOf("1000")==Integer.valueOf("1000")); returns true false ? ps. I know == is different from equals()     
asked by 31.01.2014 / 05:36
1
answer

How to compare two ArrayList and get the values shared by both?

I have two classes, they are: Class FilterCity: public class FiltroCidade { private int idCandidato; private List<String> cidades; public FiltroCidade(){ } public int getIdCandidato() { return idCandidato;...
asked by 04.11.2016 / 16:53
2
answers

Why does my try / catch only accept "Exception e" (Generic)?

I want to specify the exceptions, not this generalized way, however, item.write only accepts Exception e public File saveFile(FileItem item, File dirFile, String filename) { dirFile.mkdirs(); File file = FileUtils...
asked by 18.03.2015 / 19:00
2
answers

How to make the GenericDAO class using Hibernate?

I wanted to know the best way to do a generic Dao of a project, using Hibernate and JPA in Java. That's all to avoid setting up a DAO for each object that will persist in the database: public class ProdutoDao { private final EntityMana...
asked by 21.07.2015 / 04:36
1
answer

How popular is a JTable with TableModel itself?

When you're messing with
asked by 04.04.2016 / 16:35
1
answer

Doubt about the IF

Does the IF function only work with Integer or does it also work with String? I was trying to create a program that would ask if you are sure you want to create the password. You can check the code below: package com.programas.Verificacao2; im...
asked by 27.01.2016 / 02:07
3
answers

Java and Offline Databases

I need a help with database in Java. I want to make a database that the program generates a file, such as "database.db" and this file I can access without needing any internet connection, using only the mentioned file. How do I do this? Wh...
asked by 19.08.2014 / 22:18
3
answers

Java / Android: How to display in StackTrace Log

How can I display the entire exception error code (FullStackTrace) in the Android Log? try { //CODE }catch (Exception e){ Log.e(TAG,e.getStackTrace()); }     
asked by 18.12.2013 / 22:08
2
answers

int and Integer - Java

I am developing a project in Java and it is in error, I have already found it but I do not understand it. public class Time{ private String nome; private ArrayList<Jogador> jogadores; private Integer gols; public void a...
asked by 08.05.2015 / 01:16