Questions tagged as 'java'

1
answer

Handling exceptions in Java

Performing a code scan with Fortify detects the following vulnerability in my code. Which tells me the following:    If the catch blocks are several, it can be uncomfortable and repetitive,   but if you "condense" catch blocks by getting a hi...
asked by 01.05.2018 / 01:55
2
answers

It is possible to cast objects of abstract classes

hi how I have a question that is killing me I hope you can help me what I know according to what I understand:    You can not instantiate objects of an abstract class my doubt: The Graphics2D class inherits from Graphics both are ab...
asked by 16.05.2018 / 09:39
1
answer

How to compare with equals a question with 2 possible answers

I'm doing an exercise in java and I have to compare the answer entered:    Do you want to continue? s / n: You must contemplate both s and S How do I do it? I can only do it with an answer     
asked by 14.07.2017 / 13:40
2
answers

Problem with decimals in Java

I'm doing small problems like practice for the course I'm following from Java. I want when I enter two results, such as: 50,000 and 20,000 the result you get is 30,000 and not 30.0 On the contrary when I write 50,000 and 42,521 the resu...
asked by 19.12.2018 / 00:10
3
answers

I do not work the average inside the for

I'm doing a program, I have a problem with the average that gives me 0, and try to put it out of for and the same thing happens, could someone tell me my error? Sentence: Given the salaries and category of 5 employees is asked...
asked by 09.08.2018 / 22:07
1
answer

Because the syntax to indicate that a parameter of a generic class is comparable is T extends ComparableT?

I've been looking at different posts about the same question but I do not understand why in the syntax <T extends Comparable<T>> you put the word extends and not the word implements , if Comparable is an in...
asked by 31.10.2018 / 00:03
1
answer

memory management

I have a question: What is more expensive in terms of memory usage: create an object of a class, use it and, after it is not occupied, equal it to null ; or keep it open throughout the process? Example: public class Conexiones { p...
asked by 28.11.2018 / 16:47
2
answers

Separate text with commas, except in quotes, with regular expressions

I have a string, which I need to separate by comma, except that the comma is in quotes. In my code, it separates me by a comma, but it also separates the comma that is inside the quote. package testSplit; import java.util.StringTokenizer;...
asked by 26.04.2017 / 04:15
2
answers

Problem print in cycle for

I want the program to ask me how many numbers I want to enter and then show me if each number I entered is a cousin or no cousin, but instead I am getting a number and immediately tell me if it is a cousin or not, then the next number and it tel...
asked by 30.08.2018 / 07:45
4
answers

Randomize

In my method I have a Random variable: public Bitmap getBmp(int nunidades,boolean base){ Bitmap bmp = Bitmap.createBitmap(ladoWidth * nunidades, ladoHeight, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bmp); int nbase =...
asked by 23.05.2017 / 12:27