以下内容转载自http://201211131343.iteye.com/blog/1766824
1. throw关键字
- public void XXX() throws Throwable{
- throw new Throwable();
- System.out.println("test");
- }
2. return关键字
- public void XXX() {
- return;
- System.out.println("test");
- }
3. continue关键字
- public void XXX() {
- for(int i=0; i<10; i++) {
- continue;
- System.out.println("test");
- }
- }
4. break关键字
- public void XXX() {
- for(int i=0; i<10; i++) {
- if(i==5) {
- break;
- System.out.println("test");
- }
- }
- }
5. while(true):
- public static void XXX() {
- while(true);
- System.out.println("when?");
- }
以上均会出现编译错误: