Saturday, 19 September 2015

Java Tutorial : Java Local Variable


Click here to watch in Youtube :
https://www.youtube.com/watch?v=Z_zljJ9bvMI&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java Local Variable
Student.java
public class Student
{
    public int getTotalMarks()
    {
        int marksScoredInScience = 80; // Local Variable
        int marksScoredInEnglish = 90; // Local Variable
        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();
        System.out.println("Total Marks : "+totalMarksOftheStudent);
    }

}
Output
Total Marks : 170
To Download VariableDemoLocalApp Project Click the below link
https://sites.google.com/site/javaee4321/java/VariableDemoLocalApp.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge