solution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thuki
    New Member
    • Aug 2007
    • 1

    solution

    sir i was create a university transcript for my semester 1 project. but i have a problem with declaring the class and calling.
    i was create a class and call that but the program doesnt run.....the error is
    "non-static variable this cannot be referenced from a static context" what is this and i want a solution....
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by thuki
    sir i was create a university transcript for my semester 1 project. but i have a problem with declaring the class and calling.
    i was create a class and call that but the program doesnt run.....the error is
    "non-static variable this cannot be referenced from a static context" what is this and i want a solution....
    You're trying to use something from an object but you don't refer to one from a
    static method. Something like this (sic):

    [code=java]
    public class NoThis {
    private int foo;
    public void bar() { ... }
    public static void baz() {
    foo= 42; // wrong
    bar(); // wrong again
    }
    }[/code]

    kind regards,

    Jos

    Comment

    • praveen2gupta
      New Member
      • May 2007
      • 200

      #3
      Hi,
      please post your code which you have written, without that it is very typical to answer.

      Comment

      • malathi krishna
        New Member
        • Aug 2007
        • 8

        #4
        Originally posted by thuki
        sir i was create a university transcript for my semester 1 project. but i have a problem with declaring the class and calling.
        i was create a class and call that but the program doesnt run.....the error is
        "non-static variable this cannot be referenced from a static context" what is this and i want a solution....

        Hi,
        Can u give ur code???

        Malathi.

        Comment

        Working...