• 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
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Why the error?

 
Ranch Hand
Posts: 82
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: 63
  • 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: 82
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: 63
  • 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: 6801
182
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:
 
Skool. Stay in. Smartness. 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!