Questions tagged as 'java'

1
answer

error when entering data by console using the Scanner class [duplicated]

I'm new in java I was practicing conditional and I wanted to do it more interactive but I have a problem and I think it has to do with the Scanner class it happens that the second time that he asks to enter the name and the score shows it in a...
asked by 01.11.2017 / 06:27
2
answers

When request.getRequestDispatcher is redirected to a doGet or a doPost

Dear Luiggi, I have a huge doubt. I schedule with Servlets and I got the following surprise: I send data by submit to a servlet_1, then it is captured by a doPost (included!) from this servlet_1 -> doPost I do a request.getRequestDispat...
asked by 20.09.2017 / 16:42
1
answer

Different powers somewhat Java

Problem Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 2 ^ 2 = 4, 23 = 8, 24 = 16, 25 = 32 3 ^ 2 = 9, 33 = 27, 34 = 81, 35 = 243 4 ^ 2 = 16, 43 = 64, 44 = 256, 45 = 1024 5 ^ 2 = 25, 53 = 125, 54 = 625, 55 =...
asked by 20.09.2017 / 02:48
1
answer

WHILE does not work

necesito que si tipo == "LATA", no entre al ciclo, pero igualmente lo hace private static String ingTipo() { System.out.println("Ingrese tipo de envase"); String tipo = scan.nextLine(); while (tipo != "LATA") {...
asked by 24.09.2017 / 21:11
1
answer

string validation only alphanumeric

How can I verify if, when entering a string (String), I only recognize characters of the alphabetic type along with their line break and if they are entered with numbers indicated on the screen?     
asked by 24.09.2017 / 04:09
1
answer

Get the difference in hours of two DateTime Java Server Faces?

Good morning my query is the following in two Datetime I capture a start date and a final date, at the time of saving my final date in the database I need you to save me a data type Float with the difference of those two dates in hours I make a...
asked by 08.09.2017 / 13:01
1
answer

Go from Milliseconds to Java Server Faces Hours?

Good day for the next query, I have a Long variable to which I assign the subtraction of two Datetime, The variable difference stores me the result in Milliseconds but I need them in hours to save them in my column of type Float and not save me...
asked by 08.09.2017 / 15:32
1
answer

How to convert an IP to byte?

I have this code: byte bEnviar[] = "jose" .getBytes(); byte ip[] = { 200,0,0,1 }; InetAddress address = InetAddress.getByAddress(ip); The problem is that it gives me an error of    Possible loss when converting from int to byte []...
asked by 10.09.2017 / 19:10
2
answers

Error with two persistence units: java.lang.RuntimeException: javax.annotation.processing.FilerException:

When compiling and executing in the IDE the application works well but when generating the jar it generates this error: An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.lang.RuntimeExcept...
asked by 20.09.2017 / 01:25
1
answer

add values of an array with recursion [duplicate]

I have to perform the sum of the values of an array using recursion (exercise for university) I am not able to make the recursive call by passing an array, I leave the code in case you can give me a hand. Code: import java.util.Scanner;...
asked by 19.09.2017 / 10:42