Groovy web console

subscribe to the feed Subscribe
to this
site
Whatever (via #groovywebconsole)
tweet this snippet Tweet
this
script

Whatever

Published 6 months ago by Shane
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Laptop {
    def brand = "Dell"
    def ranking = 4
    def ram = "8GB"
    def whoCares = "97587587tggi"
}

def printStuff(obj,methods){
    methods.each{ m->
        println obj."$m"
    }

}


def x = new Laptop()

printStuff(x, ["brand","ranking","whoCares"])