so I’m having a small problem in java. I have something like “Victor Fleming” “Gone With” “With The” “The Wind.” So what the sentence should actually look …
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 code, try
What is the quickest way to determine if two elements are in the same row or column in a 2D array?
As part of one of my programs, I’m trying to check if two elements in a 2D array are part of the same row or column. I know there might be many ways to go about this, mainly with loops and by iterating through the array, but I was just wondering: is there any quick way to determine this? Let’s
How to solve Cannot invoke “String.compareTo(String)” because “[]” is null?
The sorting works on the id but i have problems in my names it wont push through the bubble sort and say its null, im just starting learning this language and it would be a great help. Ive been working on this since last night and ive tried transffering it under the if else(choice == 2) still it says null.
How to replace a value of the given key path in dynamic json object using java
I have dynamic JSONs and their key-path, I need to change the values of the Json on received key paths As an example, in have below JSON and key (cars.car1) I need to change the value of cars.car1. as “Benz”. Also Please Note JSON body and its keys will change from time to time. As an example, next time I
Read integers from a text file and store them into an array in Java
So I have a text file with integers in it like this: How can I read the file with above integers and store them into an array starting with 20 and ending with 10. Answer You can use java’s file nio.file api to read file data into string and then split that string using space to String[] and convert each
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[].
How to retrieve arrays from FirebaseFirestore using Collections?
This is my Firestore database Now here I want to retrieve Description and No. of Options which is saved in the form of an array, my code above prints other details of the data as well, with respect to the topic name selected hence I’ve used whereEqualTo(“Topic Name”, message)as my query(where the message is the topic I select). How to
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 basically you end
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; …