Jump to content

Groovy :Compilation Error when I called a non static method from main method


This topic is 1794 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Error:(14, 17) Groovyc: Apparent variable 'conversion' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance variable from a static context.
You misspelled a classname or statically imported field. Please check the spelling.
You attempted to use a method 'conversion' but left out brackets in a place not allowed by the grammar.

 

Code in Groovy

class conversionRate {
    int x

    int getX() {
        this.x = 200
        return x
    }
    static void main(String[] args) {
        conversionRate conversion  = new conversionRate()
        println(conversion.getX())
    }


}
Link to comment
Share on other sites

This topic is 1794 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.