Questions tagged as 'java'

4
answers

Center TextView

I wanted to know how to center a textview, since the title of the app is outdated to the right and not in the center of the screen,  Thank you. <TextView android:layout_width="match_parent" android:layout_height="wrap_content" a...
asked by 05.04.2016 / 17:14
3
answers

I do not understand the second and third principles of solid

Single Responsibility: each object must have a unique responsibility Open / Close: open for extension, closed before changes Liskov Substitution: daughter classes should be able to be treated as parent classes Segregation interface: many i...
asked by 12.11.2016 / 04:02
5
answers

Display of results in java

I made a program that allows me to enter any number with a limit that the user establishes, and so display the odd and even ones, but when I do, I have a comma on the right. Even numbers are: 2, 4, Odd numbers are: 3, 5, How can I...
asked by 18.10.2018 / 06:46
4
answers

Go through 2 lists in java

List<String> DiasSemana = new ArrayList<>(); DiasSemana.add("Lunes"); DiasSemana.add("Martes"); DiasSemana.add("Miércoles"); DiasSemana.add("Jueves"); DiasSemana.add("Viernes"); DiasSemana.add("Sábado");...
asked by 20.04.2018 / 04:35
2
answers

Adjust the date using Calendar. AM-PM error

I want to create a Calendar object, but how can I take a given hour and minutes and adjust the date? Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR,hora); //valores tomados de un TimePickerDialog c.set(Calendar.MINUTE,minutos); //val...
asked by 31.03.2018 / 00:57
1
answer

ERROR insert JDBC data MYSQL Java

I've been trying to insert all the data I get through the scanner into the database all day yesterday and I get an error, I can not find the solution anywhere. I get this error message:    Exception in thread "main"   com.mysql.jdbc.except...
asked by 21.03.2018 / 13:07
2
answers

Delete two or more blank spaces regular expression

I need your help because I have a regular expression to delete two or more blank spaces, but I have tried in several ways and I can not get the expected result, you can guide me please. Case No. 1 String texto = " 95716 B VO 21513836...
asked by 18.08.2018 / 20:04
2
answers

In java, use a different class depending on the operating system

I have a system that works in multi-platform, and to be able to design it I need to know how I could run a class depending on the operating system. I have created the following simple function Public Boolean esandroid(){....} where if...
asked by 01.02.2018 / 15:47
2
answers

Android Fill in with decimals

I have a report where I show certain numerical values that come to me from a service x, My problem in particular is that if the number is 5.10 the service sends me 5.1 If I send 5.00 the service brings me 5 But if I send 5.23 if I ge...
asked by 16.01.2018 / 20:40
2
answers

how do I eliminate the last character of an impression made by FOR in java?

I have: for(i=0; i<vector.length; i++) { System.out.print(Integer.toString(vector[i]) + " < "); } Example: The exit would be    1 < 2 < 3 < 4 < This last sign I would like to eliminate from printing, try substring...
asked by 29.10.2017 / 06:07