Skip to content
Advertisement

Tag: arrays

How to randomize ArrayList without using Collections.swap()?

I was asked to create a method that randomly rearranges my list which contains arrays. The list contains multiple persons and their names and surnames. My question is how do I move a person (array containing two elements name and surname inside the list) to a different index without using the method swap()? Because our list does not support that

How to Sort Array and populate it

so I NEED to sort this array by column and populate it bu user input. so this is my code and if you can help me it would be great.. so I NEED to sort this array by column and populate it bu user input. so this is my code and if you can help me it would be great..

Can someone tell me what is the problem in my code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 10 months ago. Improve this question Class pair main function What I want to do is to create an array of objects of class pair and take input in the array

Java using scanner for user input to set size of array

I want to allow for the user to be able to choose the size of the int array in my program Right now I have the following code: I’m not sure why but when I go to test and print my Array.toString it simply prints ”'[]”’ (obviously it is not doing what it should be doing and populating the int

Sort an array with user defined datatype in java

This question is from geeksforgeeks : Here’s the link: https://practice.geeksforgeeks.org/problems/find-all-pairs-whose-sum-is-x5808/1# Q) Given two unsorted arrays A of size N and B of size M of distinct elements, the task is to find all pairs from both arrays whose sum is equal to X. I have to sort the result in ascending order but the datatype for array here is user-defined

java for loop early termination

This is the first half of my java program- to input certain values. I noticed that the first ‘for loop’which takes in values of the answer key is getting terminated after 2 or 3 iterations instead of the expected 5, and I have, so far, had no luck in figuring out why. Any help would be appreciated, thanks! Answer BufferedReader.read()

Advertisement