一个javax.speech的小程序:
import javax.speech.Central;
import javax.speech.synthesis.*;
public class TrySpeech {
public static void main(String[] args) {
Synthesizer synthesizer = Central.createSynthesizer(null);
synthesizer.allocate();
try {
synthesizer.speak("Hello I am a computer", null);
synthesizer.speak("Hello I am a <EMP>computer</EMP>", null);
synthesizer.speak("Hello I am a <PROS PITCH=" + 10% ">computer</PROS>", null); //在这行报错
} catch (Exception e) {
e.printStackTrace();
}
}
}
在eclipse中敲完代码后报错:The operator % is undefined for the argument type(s) int, String
查过很多资料,类似错误案例很多,但与我这个代码的情况都不相同,不知道如何解决,求大神解惑