• Post Reply Bookmark Topic Watch Topic
  • New Topic

interaction with the arrays is not working  RSS feed

 
Igor camargo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks. I'm writing an exercise for my college, but after writing the whole code, the result of my interaction with the arrays is not working. Could someone help me in finding the error in the logic of my code? (I have to put in the result the repeated numbers of the two sequences of numbers! But here it is going blank and does not show what I want, only the sequencing appears and then the result is 0!)

Staff note (Liutauras Vilda):

Fixed incorrectly applied code tags

 
Liutauras Vilda
Sheriff
Posts: 4917
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Igor camargo wrote:Could someone help me in finding the error in the logic of my code?

What is the logic of your code? What it supposed to be doing? What it actually does? Any error messages? (post them here in case 'yes').
 
Igor camargo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code must check the repeated numbers of the two sequences and print on the screen the sequences and numbers that are present in the same sequence! the teacher allows you to use only Java.lang.
My result is coming out with nothing! I know how to solve using, collections, but the teacher will not accept!
9db71e55d00bde5957d21c97629977588da4a655.png
[Thumbnail for 9db71e55d00bde5957d21c97629977588da4a655.png]
 
Paweł Baczyński
Bartender
Posts: 2083
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you check the value of counter variable (you may use println) on line 37.

By the way, it would be better to declare counter inside the if (after line 22).
That way you wouldn't need to reset it and you would not encounter bugs in case you forgot to do so.

Also, I don't like line 11. Why have you hard-coded the content of the array inside println call?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!