Thursday 17 December 2015

Java Tutorial : Java this keyword (print this)


Click here to watch in Youtube :
https://www.youtube.com/watch?v=6PRs713q2Dc&list=UUhwKlOVR041tngjerWxVcc

Student.java
public class Student
{

    private String name;
    private int age;

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

    public void printThis()
    {
        System.out.println("this          : " + this);
    }

    public static void main(String[] args)
    {
        Student studentObject = new Student("Peter", 45);
        System.out.println("studentObject : " + studentObject);
        studentObject.printThis();
    }

}
Output
studentObject : Student@48533e64
this          : Student@48533e64
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/ThisKeyWordDemoPrintApp.zip?attredirects=0&d=1

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f95cef6f929a55d126484d6f51e7b129a718c586/BasicJava/ThisKeyWordDemoPrintApp/?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
  • No comments:

    Post a Comment