How can I format an inline code in Confluence like this? I mean, not a separate code block, but just inline classname, for example.
inline code
like this
classname
If you want to insert a large code block with optional line numbers, etc use the Code Macro (available under Macros -> Other).