View RSS Feed

Recent Blogs Posts

  1. Class and Method Cheat Sheet

    by , 10-17-2012 at 10:42 PM
    Declaring a Class
    Java Code:
    class ClassName{
      ...code...
    }

    Declaring a Class with Parent
    Java Code:
    class ClassName extends parentClassName{
      ...code...
    }

    Declaring a class with Interface
    Java Code:
    class ClassName implements interface1, interface2, interface3{
       ...code...
    }

    Declaring a Class with Fields
    Java Code:
    class ClassName{
      public
    ...

    Updated 10-18-2012 at 12:30 AM by penguinCoder

    Categories
    Cheat Sheet
  2. Constructor calling ordering

    by , 11-13-2011 at 11:34 AM (My Java Tips)
    Constructors are used for initialization normally. Name of constructor should be same as that of the class. If no constructor is declared, a default constructor is created without parameters. Constructor does not return any thing.


    Consider the example below. ClassB inherits from ClassA. In the MainClass, we made an object of ClassB. Default constructor will be called. But the output suggests that first Constructor of ClassA is called and then the constructor of classB is called. ...