Skip to content

Tag: arrays

frequency of each element in array

I tried to delete the duplicate value and print the count of each element. But I didn’t get the correct answer. How to delete only the duplicate value and print the count? Here is my code I need output as Answer The problem is that you are removing an element and not updating j accoridngly. To fix your …

number of page of document in Java

I have the base64 and the byte[] of a pdf document, and I need to obtain from this number of page of the document how I could do it. Answer Your question is not quite clear. What do you mean that you have the base64 encoded byte[]? Normally you either have a base64 encoded string or an byte[].

2D Array where each element is a List

I’m trying to write a program where I have a 2D array, stored_variables[][], where each element of stored_variables is a list rather than a normal element. I know how to make a 2D array of lists, but not how to do this. Answer You just create your 2D array, and put another array inside each field. So ba…

Can’t use array of objects

I have a Main and a Cars classes, and I am trying to create an array of Cars and have it like this: public class Cars { protected String brand; protected int price; protected Cars[] list; …