Questions tagged as 'java'

2
answers

Problem checking list

I have a problem that I do not understand because, it is the following: When I add an item to the list, it has to check if this item is already in the list but it is not doing it. if(textNameD.getText().length() > 0 && textNota.getT...
asked by 08.12.2016 / 17:19
2
answers

Why does not a private method go into the documentation in Java?

Why does not a method have a void modifier as it does not appear in the documentation? As soon as I put the public it appeared in the documentation. Is there any more modifier that interferes with this?     
asked by 14.01.2018 / 00:39
2
answers

Java polymorphism

In the context of inheritance, when B is subclass of A , an instance of B can be used anywhere where an instance of A is valid. This is the characteristic of polymorphism. However I have a question. I know it's correct...
asked by 11.01.2018 / 20:01
2
answers

Regular expression to find numbers in the middle of words

I'm currently developing a project that I'm using regular expressions to find certain patterns, however there is a specific String and I need to extract two numbers from this, the expression is like this: Agência: 0000 Conta: 00000-0...
asked by 27.02.2018 / 19:28
2
answers

How to go through Enum in Java

I have the following Enum: public enum TipoPokemon { FIRE("FIRE"), WATER("WATER"), GRASS("GRASS"), ELECTRIC("ELECTRIC"), ICE("ICE"), DARK("DARK"), GHOST("GHOST"), FAIRY("FAIRY"), PSYCHIC("PSYCHIC"), DRA...
asked by 10.11.2016 / 16:26
2
answers

Picking time in the format: HOUR: MINUTE: SECOND

I currently use this code: // Pega a hora Date hora = new Date(); hora.getTime(); It returns me this:    Thu Aug 28 21:55:42 BRT 2014 I'd like a way to get only hour, minute, and second. How to do this?     
asked by 29.08.2014 / 02:57
3
answers

problems printing a double number

I'm having trouble printing a double number, for example I create a variable of type double, and it receives the one division 1/3, it would have to show 0.3, What do I have to do to print 0.3 ??? public class MeuTeste{ public static void mai...
asked by 20.02.2014 / 15:35
1
answer

Instantiating an object in the same class as the constructor is "inelegant"?

It is always seen as a good programming practice if you create a class for the object, where we have the constructor and we make the methods and another class where we instantiate several objects of the class created previously. However, I wou...
asked by 28.12.2018 / 13:21
2
answers

Error compiling code with import java.util.Random; random.nextInt ()

I'm studying the Java programming language and found an obstacle, by some chance I can not compile this code import java.util.Random; public class Random { public static void main(String[] args){ Random num = new Random();...
asked by 18.07.2016 / 21:50
5
answers

delete repeated values array java

I am trying to print an Array without repeating, ie I have: ja={1,2,3,3,4,5,6,6,8,9}; and the result will be: jaresul={1,2,3,4,5,6,8,9} Ideas?     
asked by 29.04.2014 / 21:25