Questions tagged as 'java'

3
answers

About printing with printf a boolean in Java

I am learning how to program in Java and I am doing an exercise where I have to print on the screen with printf a Boolean variable. The variable in question is gender, which can be M or F. Let's see the initialization of the variable:...
asked by 04.03.2018 / 15:28
1
answer

Add node to a linked list and write the list in a .csv file?

I have the following code, what I do is read a dataset with the .csv format and pass its information to linked nodes. It turns out that I want to add a new node to the linked list that I have and rewrite the dataset again with the new record,...
asked by 28.02.2018 / 07:35
2
answers

Is it mandatory to call the constructor of the base class from the constructor of a class inherited from it?

My problem is the following, when inheriting from a class (Base, whether abstract or not) which has one or more constructors defined explicitly I am forced to call some of them in any constructor that defines the derived class because if I do no...
asked by 24.02.2018 / 01:16
1
answer

Android: Error in requestAudioFocus ()

Create this class to play a sound file on android: link The problem is that when running this application on my cell phone it stops instantly. When reviewing the logcat it appears this error. Using the android studio debugger I was abl...
asked by 27.05.2018 / 16:30
1
answer

Error converting a String to an object Date formatted as dd / MM / yyyy

Good morning; I am trying to convert a String containing the following string 2017-11-29 , to an object Date with the format dd/MM/yyyy , however it throws an error when trying to do parse() .    java.text.P...
asked by 27.11.2017 / 16:45
1
answer

Why is not the System.out.println that is in the while printed on the console?

package Ejercicio15; public class AcumuladorInteractivo { private double nota; //GET AND SET public double getNota() { return nota; } public void setNota(double nota) { this.nota = nota; } //METODOS public double media(double nota) {...
asked by 15.11.2017 / 16:01
2
answers

How to combine two integers and one text string?

Currently I have the dilemma that I want to do a certain operation with different basic math signs (add, subtract, multiply etc.). But I want the sign to be the only one that changes when doing the operation: Previous code resultado = resul...
asked by 12.10.2017 / 19:14
2
answers

Insert element at the beginning of an array. Java

How can I insert an element (an integer for example) at the beginning of an array? I can not use the ArrayList class or anything like that, can you help me please? Thanks in advance. This is the header of the method public void addFirst(int...
asked by 29.01.2018 / 17:07
1
answer

Switch where the case is the value of a cycle for

In my application I have implemented a button where pressing it shows a dialog with options to choose. These options are dynamic, that is to say, they are never going to be the same amount of options, because this makes it difficult for me to de...
asked by 04.02.2018 / 23:18
4
answers

can I have different values for a variable? [closed]

something like that brand = Dell or Toshiba or Lenovo in java     
asked by 06.11.2017 / 14:33