Wednesday 23 December 2015

Java Tutorial : Java Constants


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

Click the below Image to Enlarge
Java Tutorial : Java Constants 
ConstantTest.java
public class ConstantTest
{
    static final int CONSTANT_VALUE = 10;
    
    public static void main(String args[])
    {
        System.out.println("CONSTANT_VALUE : "+CONSTANT_VALUE);
        //CONSTANT_VALUE=70;
    }
}
Output
CONSTANT_VALUE : 10
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/ConstantDemoApp.zip?attredirects=0&d=1

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/ConstantDemoApp/?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
  • Java Tutorial : Java Class Methods or Static Methods


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

    Click the below Image to Enlarge
    Java Tutorial : Java Class Methods or Static Methods
    ClassMethodTest.java
    public class ClassMethodTest
    {
    
        public static void main(String[] args)
        {
            ClassMethodTest.display("Hello");
    
            ClassMethodTest classMethodTest = new ClassMethodTest();
    
            /*
             * You can also refer to static methods with an object reference like
             * below. but this is discouraged because it does not make it clear that
             * they are class methods.
             */
            classMethodTest.display("Peter");
        }
    
        /*
         * Static methods, which have the static modifier in their declarations,
         * should be invoked with the class name, without the need for creating an
         * instance of the class.
         */
        public static void display(String str)
        {
            System.out.println(str);
        }
    
    }
    
    Output
    Hello
    Peter
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/ClassMethodDemoApp.zip?attredirects=0&d=1

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

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/ClassMethodDemoApp/?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
  • Java Tutorial : Java Access modifiers (constructor)


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

    Click the below Image to Enlarge
    Java Tutorial : Java Access modifiers (constructor) 
    Java Tutorial : Java Access modifiers (constructor) 
    Java Tutorial : Java Access modifiers (constructor) 
    Java Tutorial : Java Access modifiers (constructor) 
    Java Tutorial : Java Access modifiers (constructor) 
    Student.java
    package mypack1;
    
    public class Student
    {
    
        public Student()
        {
            System.out.println("Default constructor ...");
        }
    
    }
    
    StudentMyPack1Test.java
    package mypack1;
    
    public class StudentMyPack1Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            System.out.println("student : "+ student);
        }
    
    }
    
    PreKgStudent.java
    package mypack2;
    
    import mypack1.Student;
    
    public class PreKgStudent extends Student
    {
    
        public PreKgStudent()
        {
            super();
        }
    
    }
    
    StudentMyPack2Test.java
    package mypack2;
    
    import mypack1.Student;
    
    public class StudentMyPack2Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            System.out.println("student : "+ student);  
        }
    
    }
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/AccessModifiersDemo-Constructor-App.zip?attredirects=0&d=1

    Github Link:
    https://github.com/ramram43210/Java/tree/master/BasicJava/AccessModifiersDemo-Constructor-App/AccessModifiersDemo

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/AccessModifiersDemo-Constructor-App/AccessModifiersDemo/?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
  • Java Tutorial : Java Access modifiers - Playlist

    Java Tutorial : Java Access modifiers (method)


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

    Click the below Image to Enlarge
    Java Tutorial : Java Access modifiers (method) 
    Java Tutorial : Java Access modifiers (method) 
    Java Tutorial : Java Access modifiers (method) 
    Java Tutorial : Java Access modifiers (method) 
    Java Tutorial : Java Access modifiers (method) 
    Student.java
    package mypack1;
    
    public class Student
    {
    
        void display()
        {
            System.out.println("hello");
        }
    
    }
    
    
    StudentMyPack1Test.java
    package mypack1;
    
    public class StudentMyPack1Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            student.display();      
        }
    
    }
    
    
    PreKgStudent.java
    package mypack2;
    
    import mypack1.Student;
    
    public class PreKgStudent extends Student
    {
    
        public void displayHello()
        {
            display();
        }
    
        public static void main(String[] args)
        {
            PreKgStudent preKgStudent = new PreKgStudent();
            preKgStudent.display(); 
        }
    
    }
    
    
    StudentMyPack2Test.java
    package mypack2;
    
    import mypack1.Student;
    
    public class StudentMyPack2Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            student.display();  
        }
    
    }
    
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/AccessModifiersDemo-MethodApp.zip?attredirects=0&d=1

    Github Link:
    https://github.com/ramram43210/Java/tree/master/BasicJava/AccessModifiersDemo-MethodApp/AccessModifiersDemo

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/AccessModifiersDemo-MethodApp/AccessModifiersDemo/?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
  • Java Tutorial : Java Access modifiers (field)


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

    Click the below Image to Enlarge
    Java Tutorial : Java Access modifiers (field) 
    Java Tutorial : Java Access modifiers (field) 
    Java Tutorial : Java Access modifiers (field) 
    Java Tutorial : Java Access modifiers (field) 
    Java Tutorial : Java Access modifiers (field) 
    Student.java
    package mypack1;
    
    public class Student
    {
    
        public String name;
    
    }
    
    StudentMyPack1Test.java
    package mypack1;
    
    public class StudentMyPack1Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            System.out.println("name : " + student.name);
        }
    
    }
    
    PreKgStudent.java
    package mypack2;
    
    import mypack1.Student;
    
    public class PreKgStudent extends Student
    {
    
        public void displayName()
        {
            System.out.println("name : " + name);
        }
    
        public static void main(String[] args)
        {
            PreKgStudent preKgStudent = new PreKgStudent();
            System.out.println("name : "+preKgStudent.name);
        }
    
    }
    
    StudentMyPack2Test.java
    package mypack2;
    
    import mypack1.Student;
    
    public class StudentMyPack2Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            System.out.println("name : " + student.name);
        }
    
    }
    
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/AccessModifiersDemoFieldApp.zip?attredirects=0&d=1

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

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/AccessModifiersDemoFieldApp/AccessModifiersDemo/?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
  • Java Tutorial : Java Access modifiers (class)


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

    Click the below Image to Enlarge
    Java Tutorial : Java Access modifiers (class) 
    Java Tutorial : Java Access modifiers (class) 
    Java Tutorial : Java Access modifiers (class) 
    Student.java
    package mypack1;
    
    public class Student
    {
        private String name;
    
    }
    
    StudentMyPack1Test.java
    package mypack1;
    public class StudentMyPack1Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            System.out.println("student : "+student);
    
        }
    
    }
    
    StudentMyPack2Test.java
    package mypack2;
    
    import mypack1.Student;
    
    public class StudentMyPack2Test
    {
    
        public static void main(String[] args)
        {
            Student student = new Student();
            System.out.println("student : " + student);
        }
        
    }
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/AccessModifiersDemoClassApp.zip?attredirects=0&d=1

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

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/14218d6dfc0ba96c475ae9bea5112ff3ce747d04/BasicJava/AccessModifiersDemoClassApp/AccessModifiersDemo/?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
  • Friday 18 December 2015

    Java Tutorial : Java using objects


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

    Click the below Image to Enlarge
    Java Tutorial : Java using objects 
    Java Tutorial : Java using objects 
    Java Tutorial : Java using objects 
    Employee.java
    public class Employee
    {
    
        String name;
        int age;
    
        public Employee(String name, int age)
        {
            this.name = name;
            this.age = age;
        }
        
        public int getSalaryInfo()
        {
            return 30000;
        }
        
    }
    
    EmployeeTest.java
    public class EmployeeTest
    {
    
        public static void main(String[] args)
        {
            Employee johnReferenceVariable = new Employee("John", 25);
            
            System.out.println("name : "+ johnReferenceVariable.name );
            System.out.println("age : "+ johnReferenceVariable.age );
            
            int salary = johnReferenceVariable.getSalaryInfo();
            System.out.println("salary : "+salary);
            
        }
    
    }
    
    Output
    name : John
    age : 25
    salary : 30000
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/CreateAndUsingObjectDemoApp.zip?attredirects=0&d=1

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

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/f95cef6f929a55d126484d6f51e7b129a718c586/BasicJava/CreateAndUsingObjectDemoApp/?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
  • Java Tutorial : Java this keyword (pass this to constructor)


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

    Student.java
    public class Student
    {
    
        private String name;
        private int age;
        private Address address;
    
        public Student(String name, int age, Address address)
        {
            this.name = name;
            this.age = age;
            this.address = address;
        }
    
        public String getName()
        {
            return name;
        }
    
        public void setName(String name)
        {
            this.name = name;
        }
    
        public int getAge()
        {
            return age;
        }
    
        public void setAge(int age)
        {
            this.age = age;
        }
    
        public Address getAddress()
        {
            return address;
        }
    
        public void setAddress(Address address)
        {
            this.address = address;
        }
    
    }
    
    Address.java
    public class Address
    {
    
        private String country;
        private String city;
    
        public Address(String country, String city)
        {
            this.country = country;
            this.city = city;
        }
    
        public String getCountry()
        {
            return country;
        }
    
        public void setCountry(String country)
        {
            this.country = country;
        }
    
        public String getCity()
        {
            return city;
        }
    
        public void setCity(String city)
        {
            this.city = city;
        }
    
        public Student getStudentWithAddress(String name, int age)
        {
            /*
             * The this keyword can be passed as argument in the constructor call.
             * 
             * It is useful if we have to use one object in multiple classes.
             */
            Student student = new Student(name, age, this);
            return student;
        }
    }
    
    StudentTest.java
    public class StudentTest
    {
    
        public static void main(String[] args)
        {
    
            Address addressObject = new Address("India","Bangalore");
            Student student = addressObject.getStudentWithAddress("Peter", 27);
            System.out.println("Name : "+student.getName());
            System.out.println("Age  : "+student.getAge());
    
            System.out.println("Country : "+student.getAddress().getCountry());
            System.out.println("City    : "+student.getAddress().getCity());
        }
    
    }
    
    Output
    Name : Peter
    Age  : 27
    Country : India
    City    : Bangalore
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/ThisKeyWordDemoPassThisToConsApp.zip?attredirects=0&d=1

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

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/f95cef6f929a55d126484d6f51e7b129a718c586/BasicJava/ThisKeyWordDemoPassThisToConsApp/?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
  • Java Tutorial : Java this keyword (return this)


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

    Student.java
    public class Student
    {
    
        public String name;
        public int age;
    
        public Student(String name, int age)
        {
            this.name = name;
            this.age = age;
        }
    
        /*
         * 
         * We can return the this keyword as an statement from the method. In such
         * case, return type of the method must be the class type (non-primitive).
         */
        public Student getStudent()
        {
            return this;
        }
    
    }
    
    StudentTest.java
    public class StudentTest
    {
    
        public static void main(String[] args)
        {
    
            Student studentObject = new Student("Peter",45);
    
            System.out.println("studentObject : " + studentObject);
    
            System.out.println("studentObject : "+studentObject.getStudent());
            
            System.out.println("Name : "+studentObject.getStudent().name);
            System.out.println("Age  : "+studentObject.getStudent().age);
    
        }
    
    }
    
    Output
    studentObject : Student@64a294a6
    studentObject : Student@64a294a6
    Name : Peter
    Age  : 45
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/ThisKeyWordDemoReturnThisApp.zip?attredirects=0&d=1

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

    Bitbucket Link:
    https://bitbucket.org/ramram43210/java/src/f95cef6f929a55d126484d6f51e7b129a718c586/BasicJava/ThisKeyWordDemoReturnThisApp/?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
  • Thursday 17 December 2015

    Java Tutorial : Java this keyword - Playlist

    Java Tutorial : Java this keyword (pass this to method)


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

    Student.java
    public class Student
    {
    
        public String name;
        public int age;
    
        public Student(String name, int age)
        {
            this.name = name;
            this.age = age;
        }
    
        public void display()
        {
            /*
             * The this keyword can also be passed as an argument in the method. It
             * is mainly used in the event handling.
             * 
             * In event handling (or) in a situation where we have to provide
             * reference of a class to another one.
             */
            displayFields(this);
        }
    
        public void displayFields(Student studentObj)
        {
            System.out.println("Name : " + studentObj.name);
            System.out.println("Age  : " + studentObj.age);
        }
    
    }
    
    StudentTest.java
    public class StudentTest
    {
    
        public static void main(String[] args)
        {
    
            Student studentObject = new Student("Peter",35);
            studentObject.display();
        }
    
    }
    
    Output
    Name : Peter
    Age  : 35
    
    Click the below link to download the code:
    https://sites.google.com/site/javaee4321/java/ThisKeyWordDemoPassThistomethodApp.zip?attredirects=0&d=1

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

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