Groovy web console

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

Groovy Class Sample

Published 1 month ago by Anshuk with tags Groovy
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Student{
    private int StudentId;
    private String StudentName;
    
void setStudentID(int pId){
        StudentId = pId;
    }
void StudentName(String pName){
        StudentName = pName
    }

int getStudentId(){
    return this.StudentId;
}

String getStudentName(){
    return this.StudentName;
}

static void main(String[] args){
        Student st = new Student();
        st.StudentId = 1;
        st.StudentName = "Groovy";
        println(st.getStudentId());       
        println(st.getStudentName());
}
}