public class Student
{
/*
* marksScoredInScience,marksScoredInEnglish are parameters.
*/
public int getTotalMarks(int marksScoredInScience, int marksScoredInEnglish)
{
int totalMarks = marksScoredInScience
+ marksScoredInEnglish; // Local Variable
return totalMarks;
}
}
StudentDemo.java public class StudentDemo
{
public static void main(String[] args)
{
Student student = new Student();
int totalMarksOftheStudent = student.getTotalMarks(50,40);
System.out.println("Total Marks : "+totalMarksOftheStudent);
}
}