Thursday, 3 December 2015

Java Tutorial : Java this keyword (access fields)


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

Click the below Image to Enlarge
Java Tutorial : Java this keyword (access fields)
Student.java
public class Student
{

    public String name;
    public int age;

    public Student(String name, int age)
    {
        this.name = name;
        this.age = age;
    }

}
StudentTest.java
public class StudentTest
{

    public static void main(String[] args) throws InterruptedException
    {
        Student student = new Student("Peter", 45);
        System.out.println("name : " + student.name);
        System.out.println("age  : " + student.age);

    }

}
Output
name : Peter
age  : 45
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/ThisKeyWordDemoFieldsApp.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ThisKeyWordDemoFieldsApp

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/68054fa19b88e552162495a83ba964283753af15/BasicJava/ThisKeyWordDemoFieldsApp/?at=master

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
  • 1 comment:

    1. You can find more diagram examples for class diagrams with keyword access in creately diagram community.

      ReplyDelete