0

I am trying to plot co-ordinates in variables. I am using the Point class and can not find a simple way to iterate the variables.

To plot a point of (0,0), I try the following code,

class Main {
  public static void main(String[] args){
    point p = new  Point();
  }
}

and get an error saying it can't find the symbol Point. (for some reason it can't find the symbol point at the start too, but I thought that was just declaring the name of the variable?) Do you have to put something before this to make it work?

Malted_Wheaties
  • 132
  • 1
  • 10
  • `import java.awt.Point` at the beginning of the file, if that's the actual `Point` class you want to use – Federico klez Culloca Jan 23 '20 at 10:42
  • Here you go https://docs.oracle.com/javase/tutorial/ your syntax is all wrong, so if you ever want to get any `Point`s going, you'll have to study a bit (a lot) first. – Kayaman Jan 23 '20 at 10:45
  • @Federico klez Culloca thanks, this fixed the error in finding the Point symbol, but what about the error saying there's a problem with the variable name 'point'? – Malted_Wheaties Jan 23 '20 at 10:46
  • @MaltedWheaties there's no variable named point. There's a variable named `p` and a misspelled type named `point`. – Kayaman Jan 23 '20 at 10:46
  • Did you search for _cannot find symbol_? If you did, did you not see: [What does a “Cannot find symbol” or “Cannot resolve symbol” error mean?](https://stackoverflow.com/questions/25706216/what-does-a-cannot-find-symbol-or-cannot-resolve-symbol-error-mean) – Abra Jan 23 '20 at 10:52

1 Answers1

4

Add the import statement for the Point class, and use capital "P" in point.

import java.awt.Point;

class Main {
    public static void main(String[] args) {
        Point p = new Point();   //--> Note 'P' in Point is capital case on each side of =
    }
}
Abra
  • 19,142
  • 7
  • 29
  • 41
A_C
  • 905
  • 6
  • 18