Skip to content
Advertisement

Tag: arrays

Generating an array of non-repeating integers

I’m trying to generate an array of 5 non-repeating integers in Java, but there are still repeats when I run it. Here’s my code so far: Any help is very much appreciated! Answer So, your for-loop is checking for repeated characters, BUT each time you generate a new value (in the while-loop) you’re not checking to see if the value

Solving a matrix equation in Java

I have been trying to implement the given formula in JAVA but i was unsuccessful. Can someone help me find what I am doing wrong? Do i need to shift the summation index and if so how? My code: Answer Just trying to collect all my comments under the question into one coherent answer, since there are quite a few

How to split an array of objects in java or Kotlin?

I have already asked one question about this here but, that answers about only strings. I could not edit that as there a couple of answers there already. Now, I get it how to split it with a space as given in that post. But, how can I split it with objects of custom class like this: Now, I want

How to add items to array of objects using loops

I’ve got a multiple student objects I want to write into with a CSV file containing their details. I’ve set each row of the CSV file to an array then was going to split each entry of the array into another array and use that to set the attributes of the object. However, each time I try, I get a

Advertisement