tyler here you go:
public class circle{
public circle(){}; // 1.this is the constructor
public void draw(){
System.out.println("draw");
} //2. this is a method. each circle object
// you create will get its own copy of this
// method. When it's called. "draw" will
// be shown at the output.
}
Above is a class definition of a circle object. This is the blueprint to create objects of type circle. This above class will compile fine, but nothing will happen when you try to run this because there is no main function. Not every class needs a main function. But if you would like to create new circles, you'll need a main function. So take a look at this.
public class circle{
public circle(){}; // constructor
public void draw(){
System.out.println("draw");
} // here is your method definition
public static void main(
String args[]){
circle red= new circle();
red.draw();
}
}
Now this new class includes the main function, and within it we create a new circle object named red. At the line circle red= new circle(); this calls the circle constructor and creates a circle object that is referenced by the variable red, and this object has a method named draw. When we call the draw method with red.draw(); the string "draw" is shown on the output. The important thing to note is that you can only create new objects of type circle in the main function. The rest of this is just a class definition of an object type circle. I'm sorry if this confuses you. I hope it helps.