Questions tagged as 'java'

3
answers

In a String separates with data separated by ";" how to get the 2nd data?

I have the string x="Alberto; jose; Felipe; Ana". I needed to get the 2nd die, how do I do it? Thank you in advance. obs: The string x is inside an array of strings.     
asked by 14.04.2016 / 21:36
3
answers

Remove first and last character from a string

I need to remove the first and last character of a String variable, I tried to use substring for this, but it is giving the following error: String index out of range And I'm not finding a way to do this, I've done it so far:...
asked by 24.10.2017 / 19:07
2
answers

Why use Int where Byte or Short? [duplicate]

Why not use the primitive type byte or short to store a person's age instead of using type int ? Do the two mentioned consume less memory? Would not that be better?     
asked by 05.01.2016 / 17:51
3
answers

Frameworks for Java Reporting

Good morning. I would like to know if there is another reporting framework besides JasperReports with iReports that you would recommend to me. Which would be? I need at least 2 frameworks, one of which I already have. Thank you in advance....
asked by 10.03.2015 / 14:16
1
answer

Input and output data in Java and data handling

I have a giant list of exercises and I only got these last two to do but I can not get NO. This I / O stop did not enter my head even though I prayed! Make a program that reads a text file, named "input.txt", consisting of integer values an...
asked by 21.09.2015 / 18:48
2
answers

Starting an Array of a Private Attribute in Another Class

I am doing some exercises and I came across a problem, it follows part of my code: class Empresa{ public String nome; public String cnpj; private Funcionario[] empregados; public String rua; public String bairro; public int livre = 0; public...
asked by 14.09.2015 / 01:24
2
answers

How to put a button that performs an AlertDialog.Builder action?

I have this method where you display a message. public void mensagenExebir(String titulo, String texto){ AlertDialog.Builder mensagem = new AlertDialog.Builder(Activity.this); mensagem.setTitle(titulo); mensagem.set...
asked by 22.01.2016 / 00:44
2
answers

How to modify an existing System.out.println

If I run this code public class main { public static void main(String[] args) { teste(20); } public static void teste(int maximo) { for(int i = 0; i < maximo; i++) { System.out.print...
asked by 06.07.2015 / 18:49
1
answer

Define method within the body of an outo method in Java

Hello, I was searching for Java and I came across the following code: cliente.getInetAddress().getHostAddress() I did not quite understand. Is this a method within another method? I tried to do: public class Post { public void Post(){...
asked by 08.06.2015 / 03:42
1
answer

Do a negation in an IF coding

I have the following condition IF : (ClientesBDM.getNomeEmpresa().toString().equals(ClientesBD.get(1).toString())) How can I check if the variables are different, ie deny this condition in the same IF     
asked by 21.06.2017 / 14:28