Groovy web console

subscribe to the feed Subscribe
to this
Student Mark Sample (via #groovywebconsole)
tweet this snippet Tweet

Student Mark Sample

Published 1 month ago by Anshuk Sharma with tags Student Mark Calculator
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Student{
 int StudentID, Mark1, Mark2, Mark3;
String StudentName;
//method for Mark Total
def Total(){
        def Total = Mark1+Mark2+Mark3;
        def Name = StudentName
        return "Student Name: " + Name + "\nTotal Marks: " + Total ;
static void main(String[] args){
    Student st = new Student();
    st.StudentID = 1;
    st.StudentName = "Ankit Chauhan";
    st.Mark1 = 40
    st.Mark2 = 50
    st.Mark3 = 80