Skip to content

Tag: multidimensional-array

Add more element to a 3×3 2D array

I’m writing an inventory list program, that provides the user with option of adding an item to the list of exiting the program. To add an item the user enters 1 and is promoted to enter the item details( item name, price and quantity of the items). The information enter by the user is entered into a 3×3 2D array

Get values by key from JSON Multi-dimensional Array

JSON: Code: Output: I’m only retrieving the first value How do I retrieve all name values from a nested JSON Array? Thanks in advance! Answer With your current implementation, you are getting JsonNode object and you are reading it’s name property, but you are not reading that property for it’s chlildren (inner objects). You have to query all nested objects

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 would I move a blank space in a 2d array?

I’m working on a Slider puzzle game and I’m not sure how I would go about moving a “blank” around the array. The puzzle would something like this but randomized. Each method has a prerequisite indicating if it can move a certain direction or not. Answer Here is an example of how you could implement right(), the rest of the