I want to store '\092' (which is backslash ASCII code) in a char variable but Java does not allow me. Does anyone know what the problem is and how I should store that?

Use the escape sequence: '\\'.

Example:

char c = '\\'; // store a backslash
commented: good solution.. +4
Be a part of the DaniWeb community

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