How can I format an inline code in Confluence like this? I mean, not a separate code block, but just inline classname, for example.
Surround your inline text with {{ }}.
Caveats:
}}{{ }} to fix it. Just retype it or paste without formatting (Cmd ⌘+Shift+V on Mac) then add {{ }} and hit space.{{ }} to existing text later, it can not be surrounded by other characters, e.g. if you want parenthesis around your preformatted text, you cannot fix (my text) by adding braces ({{my text}}). First add space around your text ( my text ) then add the {{ }}.