Hi everyone, I am trying to write and application that will display a smiley face with a gray background and yellow face. This is what I have so far but it won't run. Can you please help me and show me how to get the application running? Thank you in advance.

import java.awt.Graphics;
import java.awt.Color;
import java.awt.Canvas;

public class Smileyface extends Canvas {
  public static void main(String[] args) {
    public smileyface() {
    setSize(800, 600);

  public void smileyface(Graphics window) {

  public void smileyFace(Graphics window) {
    window.drawString("SMILEY FACE LAB ", 35, 35);

    window.fillOval(210, 100, 400, 400); // face

    window.fillOval(290, 180, 40, 40); // left cornea
    window.fillOval(490, 180, 40, 40); // right cornea

    window.fillOval(300, 190, 20, 20); // left iris
    window.fillOval(500, 190, 20, 20); // right iris

    window.fillArc(310, 200, 200, 200, 0, -180); // smile

"it won't run" ....
can you be a bit more specific about that?

a few hints: your constructor is wrong:
it's inside the main method, which goes against Java syntax (actually, you try to write your entire class inside your main method, which is all kinds of wrong).

it's name isn't the same as the name of your class, which is also wrong.

correct these two. the code 'll "run", it won't do what you want yet, but it'll run.

Edited 3 Years Ago by stultuske

This question has already been answered. Start a new discussion instead.