Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Why the error?

 
Ranch Hand
Posts: 87
1
VI Editor Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hanna Roberts wrote:As I wrote before, it gave an error when I ran it when I changed it to that



Do not mistake 'System.out.println()' and 'System.out.print()', those are different. First one has version without argument, second one does not.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I had written



and I attached a picture of the error
Screen-Shot-2020-03-27-at-6.23.40-AM.png
[Thumbnail for Screen-Shot-2020-03-27-at-6.23.40-AM.png]
 
Miroslav Lehotsky
Ranch Hand
Posts: 87
1
VI Editor Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hanna Roberts wrote:...and I attached a picture of the error



Do you even read what people are writing to you ? Try to go again over my previous post, if I mention that 'System.out.print()' method has version without argument, or is it the 'System.out.println()' ? And then look at your code, and hopefully you'll see that you did the exact opposite.
 
Hanna Roberts
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry I missed that post because it was on the next page
 
Sheriff
Posts: 7072
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hanna Roberts wrote:so the failed tests are shown in the picture I attached, I guess it has to do with the use of void instead of strings in your code?


Yes, it looks like the method strPattern() needs to return a String, not print to the console.  The signature should be:
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic