Proberly a very simple question, but within Java, I have a string as follows:
public static String wincpuload = "cmd /c @for /f "skip=1" %p in ('wmic cpu get loadpercentage') do @echo %p%";
Although I get a syntax error because of some of the charcters in the string are breaking it. Similarly in C#, if you have this kind of problem you do:
string test = @"C:\testing\test"
How can you overecome this in java?
Just use a back slash (\) to escape your double quotes. Note the syntax highlighting below:
Incorrect
Correct