This is my code. I'm printing the line seven times but it is not validating the output.

public class Solution
{
    public static void main(String[] args)
    {
        System.out.print("It’s kind of fun to do the impossible. ");
        System.out.print("It’s kind of fun to do the impossible. ");
        System.out.print("It’s kind of fun to do the impossible. ");
        System.out.print("It’s kind of fun to do the impossible. ");
        System.out.print("It’s kind of fun to do the impossible. ");
        System.out.print("It’s kind of fun to do the impossible. ");
        System.out.print("It’s kind of fun to do the impossible. ");
    }
}

asked 05 Jun '15, 11:13

Osama%20Arshad's gravatar image

Osama Arshad
12
accept rate: 0%


Remove the space at the end of each statement after the full stop.

link

answered 07 Jun '15, 08:30

Vivek's gravatar image

Vivek
112
accept rate: 0%

And also change ’ to ' and System.out.print to System.out.println (at least in first six lines). Now it should work fine.

link

answered 13 Aug '17, 17:40

pwwl's gravatar image

pwwl
11
accept rate: 0%

edited 13 Aug '17, 17:41

Why dont work?

public class Solution

{ public static void main(String[] args)

{
   String s="It's kind of fun to do the impossible.";
    print3Time(s);
    print4Time(s);

}

public static void print3Time(String=s)
{
System.out.println(s);
System.out.println(s);
System.out.println(s);
}

 public static void print4Time(String=s)
{
System.out.println(s);
System.out.println(s);
System.out.println(s);
System.out.println(s);
}

}

link

answered 01 Dec '17, 04:29

zhuk's gravatar image

zhuk
11
accept rate: 0%

edited 01 Dec '17, 04:33

In you method, there shouldn't be "=" between "String" and "s". Look at the code below that works.

public class Solution { public static void main(String[] args) { String s = "It's kind of fun to do the impossible."; print7Times(s); }

  public static void print7Times(String s)
  {
      System.out.println(s);
      System.out.println(s);
      System.out.println(s);
      System.out.println(s);
      System.out.println(s);
      System.out.println(s);
      System.out.println(s);
  }

}

link
This answer is marked "community wiki".

answered 22 Feb, 09:36

dadyl11's gravatar image

dadyl11
11
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×2

Asked: 05 Jun '15, 11:13

Seen: 1,454 times

Last updated: 22 Feb, 09:36

Related questions