• 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

I know that is simple but I don't get it why this code didn't run.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Rancher
Posts: 3523
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried to run the code?
Were there error messages?
Please copy the full text of the error message and paste it here. It has important info about the error.

Some major problems with the code is there is no class declaration or main method to start the class's execution.

Also be sure to wrap all posted code in code tags.
 
Marshal
Posts: 66189
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You appear to have tried to use the code button: this inktells you how it works. Since you are new, I have corrected the code tags, and doesn't it look better now.
The code runs on JShell. As Norm said, what went wrong when you tried to run your code?
Why are you using the two for loops with break;? I think that for loops are inappropriate control structures for waht you require. I think, indeed, you shouldn't be using loops at all.
 
And inside of my fortune cookie was this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!