CodeGym
Christmas Sale
CodeGym University
Learning
Course
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme
Question
  • Reviews
  • About us
Start
Start learning
Start learning now
  • All questions
Neil
Level 5
Hyderabad
  • 13.01.2020
  • 961views
  • 3comments

Whats wrong in this code?

Question about the task Sam I Am
Java Syntax,  Level 3,  Lesson 6
Under discussion


Display all possible combinations of the words "Sam", "I", "Am".

Hint: there are 6 combinations.
Display each combination on a new line. Do not separate the words.

Consider this example:
IAmSam
AmSamI
...

Requirements:
  • The program should output text.
  • The displayed text should contain 6 lines.
  • The text on each line must be unique.
  • All possible combinations should be displayed.
package com.codegym.task.task03.task0313; /* Sam I Am */ public class Solution { public static void main(String[] args) { //write your code here System.out.println("IAmSam"); System.out.println("ISamAm"); System.out.println("AmISam"); System.out.println("AmSamI"); System.out.println("SamIAM"); System.out.println("SamAmI"); } }
0
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Lunita
Level 4
13 January, 13:52
You have an Upper case M in one of the lines
0
lalit mehra
Level 4 , India, India
4 September 2021, 13:53
take 3 string
0
Diana Salvador
Level 26 , Sintra, Portugal
13 January 2020, 16:53
I think the error is in line 15: System.out.println("SamIAM"); It should be System.out.println("SamIAm");
+7
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Game Projects
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning and Java developer’s career.
Follow us
Interface language
Programmers Are Made, Not Born © 2023 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2023 CodeGym
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.