-4

Here is my code:

package Main;
import java.awt.*;
import java.awt.Event;
import javax.swing.*;

public class Gamestart {

    public static void main(String[] args) {

    Image i = new Image();

    }

}

It gives me an error. I know that this is supposed to happen when it's an abstract class, but it's not abstract,and the superclass is just java.lang.Object. Does anyone know why this is happening?

EDIT: Okay, i learned that java.awt.image is abstract, but still, how come it still gives me an error?

Matt cejpa
  • 15
  • 2
  • 5
  • 3
    `java.awt.Image` *is* an abstract class. – Thilo Aug 02 '13 at 00:05
  • You will want to take a look at [Working with Images](http://docs.oracle.com/javase/tutorial/2d/images/), in particular, look for `BufferedImage` – MadProgrammer Aug 02 '13 at 00:20
  • 1
    `"Okay, i learned that java.awt.image is abstract, but still, how come it still gives me an error?"` -- um,... maybe because it **is** abstract, as you now admit to see. So why should this confuse you? – Hovercraft Full Of Eels Aug 02 '13 at 01:42

1 Answers1

7

I know that this is supposed to happen when it's an abstract class, but it's not abstract

see JavaDoc:

public abstract class Image
extends Object

The abstract class Image is the superclass of all classes that represent graphical images. The image must be obtained in a platform-specific manner.

jlordo
  • 37,490
  • 6
  • 58
  • 83