• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

interaction with the arrays is not working

 
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

 
Sheriff
Posts: 7696
533
Mac OS X VI Editor BSD Linux
  • 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]
 
Bartender
Posts: 2233
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • 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?
 
    Bookmark Topic Watch Topic
  • New Topic