Click here to watch in Youtube :
https://www.youtube.com/watch?v=0gZLmoed5KM&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Parameters |
public class Student { /* * marksScoredInScience,marksScoredInEnglish are parameters. */ public int getTotalMarks(int marksScoredInScience, int marksScoredInEnglish) { int totalMarks = marksScoredInScience + marksScoredInEnglish; // Local Variable return totalMarks; } }
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); } }
Total Marks : 90
https://sites.google.com/site/javaee4321/java/VariableDemoParamApp.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment