Results 1 to 2 of 2
  1. #1
    KiranA is offline Member
    Join Date
    Jul 2011
    Posts
    23
    Rep Power
    0

    Default Cannot use as static constant

    HI, im getting a error for this line. wt is the problem?


    BufferedImage image = ImageIO.read(this.getClass().getResource("fruits.j pg"));.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default Re: Cannot use as static constant

    Are you in an instance of whatever class this code is in, and not a static method?

Similar Threads

  1. Returning or printing the name of a constant
    By LuciferInTears in forum New To Java
    Replies: 2
    Last Post: 10-01-2011, 01:17 AM
  2. Constant Variables
    By harshakantha in forum New To Java
    Replies: 3
    Last Post: 06-13-2011, 07:51 AM
  3. constant variables questions
    By sgthale in forum New To Java
    Replies: 3
    Last Post: 05-06-2011, 05:34 AM
  4. switch() don't work with constant
    By jarek in forum Advanced Java
    Replies: 3
    Last Post: 11-19-2010, 08:59 AM
  5. static constant and performance
    By felixtfelix in forum New To Java
    Replies: 2
    Last Post: 08-31-2010, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •