Questions tagged as 'java'

3
answers

What to do when the argument passed in the constructor is invalid?

I'm doing a card game in Java, and one of the classes takes responsibility for starting the game. In the constructor, I get the number of players that will participate. I am doing the validation of the amount of players in the constructor itse...
asked by 27.09.2017 / 23:32
3
answers

Why does not my Array item change in the foreach?

In the method call: AlunoPrivado aluno = new AlunoPrivado(); aluno.addCursos("Portugues", "matemática", "história", "física"); boolean result = aluno.changeCurso("Portugues", "ciências"); Implemented method: public boolean changeCurso(...
asked by 06.02.2016 / 02:46
3
answers

How to read CSV files in Java

I'm developing a web application, where after the user uploads a CSV file, my java application needs to read this CSV. Preferably separate the data into fields, so that you can add these to a database for example. After some research done on...
asked by 29.07.2014 / 20:31
1
answer

How useful the operator! in Java?

In if(!aplicaDescontoDe(valor)); in which the aplicaDescontDe method is a boolean, how does it work I did not understand? In this Example: public boolean aplicaDescontoDe(double porcentagem) { if(porcentagem >0.3) {...
asked by 01.08.2015 / 00:39
4
answers

Select string randomly

I need a way to randomly create a string between some options. Let's say I have the strings "A" "B" and "C", would it be possible for Java to choose randomly?     
asked by 10.11.2014 / 19:17
2
answers

Pass two parameters to a function that accepts only one parameter

I've been making a code to generate a pdf from the framework Itext in Java. I came across the following situation, I needed to define a phrase like negrito and sublinhado . After searching Google, I found a user's su...
asked by 13.09.2014 / 15:20
1
answer

How do I determine if a point on a swing component is visible on the screen?

How do I determine if a particular X point inside a swing component is visible on the user's screen? For example, let's assume that% w / w has been added to a B window (usually, but not necessarily, a% w of%). > Using the JComponen...
asked by 11.01.2015 / 13:57
1
answer

Close Window popup in Java (Selenium WebDriver)

I'm testing a website in java and need to close a window pop-up, the problem is that I already tried to use Selenium to close it and I could not. Is there any simple way to date it using JAVA? You do not have to click anything, I just need to...
asked by 13.05.2015 / 21:32
1
answer

Input type file does not work in webview

I have an HTML page that has a form of uploading images in Chrome on your pc or in any browser works but in my application it has a WebView that opens this page then clicking choose file does nothing. Is it possible to arrange thi...
asked by 16.01.2017 / 17:36
4
answers

Doubt about exercise with abstract class in Java

I would like to ask for your help again in this exercise. This time using the abstract class.    Create an abstract class FuncionarioAbstract with the String name attribute and the abstract method: public double getSalario();...
asked by 17.11.2016 / 14:58