When posting code, I get error

begin a line with 4 spaces in a row (or one tab), preceded by a blank line. 4+ spaces or tabs may not be used anywhere else.

You probably have some whitespace somewhere else, that is not a code block. Ensure that the only lines in your message that are indented with spaces or tab are code, and they are preceded and followed by a blank line.

Test line. Not code.  Does it work? Yup.
    tabbed.
  Spaced third test line.

Can you share exactly what you are doing?

I suggest that you type in the post, and then click on where it says Preview. It should highlight where the error line is.

One method I've had a lot of success with. Start with your IDE. Make sure the code you want to copy is properly formatted. Copy the code. Make sure you have an empty line between where the code will be pasted and the last text you typed. Paste the code. If it turns green you're good to go. If not select all the code and hit tab. It should now be green. This indicates that your code is accepted as code.

I generally compose anything of length with MarkDownPad (free) and then copy/paste once I have the formatting correct. It also saves me from having to retype anything in the event of a posting error.

Testing

public static void main(String[] args){
       System.out.print("Testing");
}

Hi All,

Thanks for the reply. I have tested and it works fine.
I will share the screen shot next time if this issue happened again.

Thanks.

If you try to type something and it doesn't go through, hitting the Preview tab should highlight the line that's confusing our Markdown parser.

share the code exactly, then you get answer

commented: I can't post because of the error +0

Can you describe your actions in details?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.