0
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and 
MouseInfo)

/**
 * Write a description of class MyWorld here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class MyWorld extends World
{
private Counter counter;
public Counter würfelanzahl;
public int Felder;
/**
 * Constructor for objects of class MyWorld.
 * 
 */
public MyWorld()
{    
    // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
    super(900, 900, 1); 
    addObject(new Würfel1(), 400, 500);
    addObject(new Würfel2(), 500, 500);
    addObject(new Auto(), 825, 825);
    addObject(new katze(), 790, 800);
    würfelanzahl=new Counter("Felder: ");
    addObject(würfelanzahl, 465, 550);
    *getwürfelanzahl().add(100);*
    Felder=0;
}
public Counter getwürfelanzahl()
{
    return würfelanzahl;
}
public void addwürfelanzahl(int würfelanzahl)
{
    Felder+=würfelanzahl;
}
}

Here i try to add an integer to an Counter. I dont understand why add() doesn't work. I gett the Error that it doesn't find the symbol and asks if I mean act(). The weird thing is I copied this of an other programm I wrote and there it works without a problem.

M. Eng
  • 1
  • The class `Counter` apparently doesn't have a method `add`, as you don't show us the code of `Counter`, we can't really help you. – Mark Rotteveel May 14 '18 at 08:14
  • Possible duplicate of [What does a "Cannot find symbol" compilation error mean?](https://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-compilation-error-mean) – Mark Rotteveel May 14 '18 at 08:14

0 Answers0