• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Help with 2d array  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to search a 2D array with duplicates but it's not working properly.

 
Marshal
Posts: 24195
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can see at least one thing in that code which is wrong. Maybe two... but I don't know what exactly it's supposed to be doing.

So why don't you start by telling us exactly what it's supposed to be doing, what it does instead, and why that's wrong.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What specific problem are you having? Note that ItDoesntWorkIsUseless(←click).
 
Paul Clapham
Marshal
Posts: 24195
54
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch, Jason!
 
Jason Brody
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is supposed to run through the 2d array and check for duplicate values. If there is a duplicate value than it should output duplicate = true. If there is not a duplicate value than is should output duplicate = false. Every number has to be unique in the array.
 
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Basically you are trying to compare int[] with == and you want to compare int values.

Different dirty aproximation


Best regards,
 
lowercase baba
Posts: 12725
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jason Brody wrote:I'm trying to search a 2D array


<pedant>
Can't be done - at least, not in Java. Java does not have multi-dimensional arrays - only one-dimensional arrays.

Now, and array CAN hold a reference to something (such as an array), which allows a lot of the same behavior.
</pedant>
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!