-1

我是使用 becker.robots 的初学者,我正在尝试新事物,例如为操作创建不同的方法以使代码本身更容易。但是,我不断收到相同的非法表达式开始错误,这让我感到沮丧。仅在第 11 行,我就遇到了 5=6 个错误。帮助别人?:(

import becker.robots.*;

public class excercisefour {
 public static void main(String[] args) {

   City tor = new City(7,7);
   Robot jesus = new Robot(tor, 0, 1, Direction.EAST);
   makeWalls(tor);


 private static void makeThings(City city){
    Thing t1 = new Thing(c, 1, 1);
    Thing t2 = new Thing(c, 1, 3);
    Thing t3 = new Thing(c, 3, 3);
    Thing t4 = new Thing(c, 4, 4);
    Thing t5 = new Thing(c, 3, 1);
    Thing t6 = new Thing(c, 4, 3);
 }

   private static void turnRight(Robot robot) { 
 for (int i = 0; i < 3; i++) { 
 robot.turnLeft(); 
 } 
   }

 private static void moveToWall(Robot robot) { 
 while (robot.frontIsClear()) { 
 robot.move(); 
 } 
   }

 private static void moveSpaces(Robot robot, int n){
    while (n>0){
      robot.move();
      n--;
    }
 }



 }  
4

2 回答 2

1

main为方法添加右大括号

public static void main(String[] args) {
    ...
} <--- this
于 2013-11-09T23:30:30.023 回答
0

在开始之前你没有关闭你的main方法makeThings。添加结束语}

于 2013-11-09T23:30:39.673 回答