The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Sorry Applet Problem

Posted by Matt Gerrans on October 10, 2001 at 5:38 PM

> I'm begginer in java and have a this error:"Applet1.java":
> Error #: 308 : non-static method getAppletContext() cannot be referenced from a static context

In the future, keep in mind it helps if you include your code.

In this case, it is clear that you are calling a non-static method from a static one (probably main()). If a method is not static, you must instantiate an object (with new) and then it can be called for that object ("object.method();").

- mfg



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us