Hello, is it possible to have a multidimensional array of different type? We have to create a simple "joke" application with GUI, and what I was thinking is that for each question a character(image) with a speech bubble asks a question like for example a joke about a banana would have a banana (image) asking a question and of course theres a text field for users to answer. so i thought maybe putting the image and question together into an array or something so then we could just call that array out later. I dont know, we maybe be making things difficult for ourselves with this approach but that's all we came up with. because as an example our lecturer used knock knock jokes so it had a background of a door with a speech bubble that would display the joke and a constant character (image) with a text box next to it for user to insert an answer. so that sort of gave the idea but instead of a constant image character, it changes according to the question. So yeah, unless theres a different approach to this?
Jump to Post
Not in Java
Object[is a multi-dimensional array that holds anything.
Because every object extends
Object, and primitives are auto boxed/unboxed into the corresponding objects as required, then you can put anything into a multi-dimensional array of
Object(including other arrays).
Having said that, it's a terrible …
All 2 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.