Questions tagged as 'java'

2
answers

Knowing how many ports are open in Java program

I have a program in Java to know how many ports are open but I'm not sure where to put the method to count the ports. Can I create a count method for open ports within the Porta class? package programa2; public class Programa2 {...
asked by 17.07.2016 / 21:44
2
answers

How to put information in the attributes of an object using ArrayList?

I created a Cliente class with attributes name, age, address, cpf. And in the main class I was to make a ArrayList of type Cliente , in this way ArrayList Cliente<String> = new ArrayList<>(); in order to create a...
asked by 25.03.2018 / 04:11
2
answers

How to put simple apostrophes and concatenate with a string?

I have a question, I want to be able to concatenate a String, so that it is interpreted with simple apostrophes between it. For example, SQL would look like this: SELECT IDALUNO, NOME, DATANASCIMENTO FROM ALUNO WHERE DATANASCIMENTO BETW...
asked by 18.03.2018 / 20:17
2
answers

Higher frequency of a string

I have a text where I am handling various things. Now I need to get the 3 words that repeat the most in the entire text. How can I do this? What is the best solution? I thought about storing in a list but I do not know how to put the word and...
asked by 09.09.2014 / 03:11
1
answer

Make the java.sql.Date object have the format dd / MM / yyyy [duplicate]

I have a field that is of type String , where a data is entered in the format dd/MM/yyyy , I'm converting to java.sql.Date , the result is: 2018-01-01. What I needed was to get the date in the format: dd/MM/yyyy...
asked by 18.03.2018 / 17:13
2
answers

Transform String into Array - Groovy

I have String as follows: [["155","123RET"],["156","124RET"]] In other words, I need to add an item in each of them, so I need them in the end to be as follows: [["1","155","123RET"],["2","156","124RET"]] I need to convert this...
asked by 21.11.2017 / 17:54
1
answer

Generating a hexadecimal string

Good afternoon, well, I am generating a random hexadecimal string in this pattern: 81c1328d-4dae-4af7-9974-893bb8ec90d4 But I would like to optimize this code here: public String geraKee(){ String letras = "abcdef0123456789"; Ra...
asked by 14.03.2015 / 19:53
1
answer

How to leave only one border in JTextField?

I would like to know how to just leave a border in a JTextField , similar to the data entry at the time of logging in Gmail, that is, with a border just at the bottom.     
asked by 14.07.2017 / 01:37
1
answer

Getting in the wrong case

I'm doing an exercise in Java that asks for registration, salary, tax and exit. I used switch case for this, of course and so far so good. However when I run and register for Java I go through case 1 and even before I put the na...
asked by 15.08.2017 / 17:57
3
answers

Validate whether the INSERT was executed successfully or not (JTDS)

I would like to know a form of validation to know if the insert was executed successfully, I have no idea how to do this because the execute () method does not return anything! Connection connInsert = DriverManager.getConnection(ConnectionURL)...
asked by 28.08.2017 / 21:58