Questions tagged as 'java'

2
answers

convert ListDocument to json

I have a problem I do not know how to convert the List<document> to json: public static List<Document> d() { conexion c = new conexion(); List<Document> resultados = new ArrayList<>();...
asked by 04.10.2017 / 22:20
5
answers

How to generate a PDF in Java with a .jasper file?

I am using JasperSoft to create my reports, I use a table to show the data I need, which is fed directly from the database through a query. By looking at the preview inside Jaspersoft it shows the data correctly, I compile the report and I creat...
asked by 12.02.2016 / 18:38
2
answers

Error sorting values from a binary file

I have the following code: try{ raf = new RandomAccessFile("Partides.dat", "rw"); for (long i=0; i< "partides.dat".length(); i= i+48){ for (long j=i +48; j<"partides.dat".length(); j=j+48){ // Es llegueixen...
asked by 07.01.2016 / 23:13
3
answers

Error in Java array ArrayIndexOutOfBoundsException

Good, I am learning to program in Java and when executing the code: package useargumeny; public class UseArgumeny { public static void main(String[] args) { System.out.print("Hi, "); System.out.print(args[0]); Syst...
asked by 28.01.2016 / 23:19
2
answers

Failed to check if a vector is inside a matrix

I'm doing an exercise in Java to check if a vector is inside a matrix. In case the first position of the vector coincides with the current position of the matrix, I will jump to the next position of the vector to follow the check. My problem com...
asked by 13.09.2017 / 19:07
3
answers

How to use ternary operator

good afternoon, I have a very specific question, what happens is that I want the user to enter a number and according to this establish whether the vehicle is a car or motorcycle, I think I already achieve it but not very well, after this I want...
asked by 26.08.2017 / 19:40
2
answers

Know if a number is even or odd using indirect recursion

Is it possible to solve an exercise where you are asked to know if a number is even or odd using indirect recursion? The slogan is: Make a recursive Algorithm that allows to know if a number is odd using indirect recursion What I do is the...
asked by 20.09.2017 / 11:47
3
answers

Even using BigDecimal I have problems with rounding

Why should I use BigDecimal in this case, I do not get the expected result? double value1 = 5.68; double value2 = 2.45; System.out.println(BigDecimal.valueOf(value1 + value2)); DEPARTURE: 8.129999999999999 EXPECTED: 8.13     
asked by 16.12.2015 / 16:20
1
answer

java.lang.RuntimeException: Unable to start activity, java.lang.NullPointerException in Android Studio

Making a code to simply show Hello, world in a TextView named st, which is referred to by the variable stat, the error comes out: java.lang.RuntimeException: Unable to start activity ComponentInfo {com.aapps.vyber.clicker/com.aapps.vyber....
asked by 30.07.2018 / 12:26
1
answer

Hangman game - Java

I have a problem with a program I'm doing, which is about creating a Hangman Game. I used a for so that the entered character is equal to one of the characters of the word (which is chosen randomly) and a if to verify if it is corr...
asked by 19.12.2018 / 02:27