by -

During Inheritance, when a method definition have the same method signature ( method name+ parameter signature) and return type in a subclass as that of its super class, then the method in the subclass is said to override the method of its super class and the mechanism is so called Method Overriding.

Having been created object of the subclass, when the overridden method is called then the object of subclass refers to the method which is defined in the subclass that does mean the overridden method which is defined in the super class will be hidden. In order to access the overridden method defined in the super class can be accessed by the subclass using ‘super’ keyword.

In OOPs, Method Overriding is a feature that let subclass define specific implementation of method which is already defined in one of its super classes’. Among the overridden methods, which version of the method will be called will be determined by the invoking object at run-time. That’s what it is called Run-time Polymorphism as Overridden methods implement “one interface, multiple use” aspect of polymorphism.

In method overriding, Java run-time system resolves the method invocation dynamically at run-time, so called Late Binding.

Features of Method Overriding

  • The access level of the overriding method in subclass can not be more restrictive than the overridden method of the super class.
  • The methods will be said to override one another when there is a Parent- Child relation between the classes.
  • Private and Final methods can not be overridden.
  • Static methods can not be overridden but can be re-declared.
  • Public or Protected non-final methods of a package can only be overridden by its subclass existing in some other different package.
  • Constructors can not be overridden.
  • Overridden can throw any Unchecked Exception.


Supports Specialization i.e. during inheritance when a subclass inherits a parent class, then subclass will have all the features of parent class and on the top of that subclass can implement specific functionality to the overriding method having same method signature and return type as same as in its super class.

Java Program

class Animal{
  void sound(){
    System.out.println("default sound...");

class Cat extends Animal{
  void sound(){
    System.out.println("mew mew...");

class Dog extends Animal{
  void sound(){
    System.out.println("vow vow...");

class MethodOverrideDemo{
  public static void main(String args[]){
    Cat cat = new Cat();
    Dog dog = new Dog();



Explanation of Code & Output

In the example sited above, Dog and Cat both are subclasses which are derived from Animal super class. In all the classes (except MethodOverrideDemo class) you will find the method sound (), which is defined under Animal class in a generic way and in Cat and Dog class has overridden the sound () method of Animal class with specific implementation as per scenario. Obviously Cat’s sound is “mew mew…” and that of dog’s “vow vow…” sound () is defined in these classes according to the need. If we create object of class Cat, then it will invoke sound () method of Cat class, same is true for object of Dog class. I guess from the output everything is clear.

Checkout more useful tutorials and definitive guidelines on Java programming here.

by -

Let us begin the discussion with some of the featured facts about the topic at hand. WordPress is currently one of the most widely used utility online for casual bloggers as well as professional web developers. With the array of tools at the user’s disposal, getting a site up and running is all a matter of few clicks and tweaks. Previously we have learnt how to display author biographies at the end of every posts in WordPress Blogs.

wp hooks

WordPress boasts a huge collection of websites and the list keeps growing. Keeping the customer satisfaction and ease of access in mind, one of the most widely sought after features of WordPress is its complete package for any web-developer. Right from the basic deployment to the site monitoring, this service has it all.

WordPress Customization

If you are a bit new to WordPress and are not much aware of WP coding then please make sure you know the essential security settings for WordPress.

WordPress brings you the capability to customize your blog or website right from the scratch without modifying its core. For any software its core is very much important and should remain unchanged which is same for WordPress. But even without touching WordPress core files, you can customize your site programmatically through template tags and functions to bring in several features. One such customization that we look upon in the following section is the WordPress Hooks.

What are WordPress Hooks?

To begin with, WordPress hooks are utilized in almost all the themes and plugins employed on the platform till date. These basically are short codes that allow users to modify parts of themes or plugins. WP hooks are basically seen to have two functionalities, either to add user generated codes (Action Hooks) to specific parts or to allow modification to root commands that build up a theme or plugin (Filter Hooks).

Action Hooks

Consider the core theme or plugin code in WordPress; there are certain places wherein external programs can push in additional sets of codes enabling the theme/plugin to perform additional functions.

An example to utilize the theme’s function.php file and an add_action() function –

  add_action( 'wp_head', 'acemous_actionhook_example' );
  function acemous _actionhook_example () {
    echo '<meta name="description" content="Hello TGC Readers!" />' . "\n";
  } // End acemous _actionhook_example()

The above code adds the text “Hello TGC Readers!” between your theme’s <head> tags. Placing “wp_head” in the call to add_action() with “get_header” would display this text above your theme.

WordPress presently supports the following Add Actions -

  • add_action()
  • has_action()
  • do_action()
  • did_action()
  • do_action_ref_array()
  • remove_action()
  • remove_all_actions()

wordpress hooks

Filter Hooks

As the name suggests it filter out or manipulates the outcome. Examples include, adding signature, formatting style as well as adding hyperlinks at the end of blog posts.

The following example would add a signature at the end of each post when viewed in full blog post screen –

  add_filter( 'the_content', 'wpcandy_filterhook_signoff' );
  function wpcandy_filterhook_signoff ( $content ) {
    if ( is_single() ) {
      $content .= '<div>This is the Footer!</div>' . "\n";
    } // End IF Statement
    return $content;
  } // End wpcandy_filterhook_signoff()

Above code adds a new div tag with the text “This is the Footer!” to the end of the content of your blog post.

WordPress presently supports the following Filter Actions -

  • add_filter()
  • has_filter()
  • current_filter()
  • apply_filters()
  • remove_filter()
  • remove_all_filters()
  • merge_filters()

The user base of WordPress has been growing phenomenally over the years and its easier handling is making it to be widely accepted as a standard in business today. You can learn more about WordPress Hooks here.

by -

There are plenty of Social Bookmarking websites as well as tools available, but here is a tutorial, which will help you to save the bookmarks to WordPress blog.

There is an interesting extension for Google Chrome related to this tutorial. The idea behind this extension is, you can replicate the functionality of delicious on your own WordPress site. This means that, you can save your bookmarks (interesting links!) not only to browsers but also directly to your own WordPress site.

Delectable Chrome Extension

If you visit a page you find interesting, you click on an icon in the toolbar and that link is then saved to your own WordPress site. If you like owning your own data, then this extension is perfect for your needs. Install the Delectable Chrome extension, which will help you to achieve this:

Delectable – A Free Google Chrome Extension for WordPress

  • Instantly published to your own WordPress (3.0 or above) blog (because the xml-rpc API changed) and it takes about 30 seconds to set up from your blog end.
  • There are quite a few other features available for this first release. You can schedule your posts or have them published immediately. You can select a category for your posts to be, but by default, the posts created by this extension will be of the ‘link’ post format – it seemed most appropriate.

How to use delectable extension:

  • Once installed, on the top right side click the ‘wrench’ icon and click ‘tools > extensions’ (which will take you to chrome://extensions/ )
  • Find Delectable and click ‘options’ (which will open a new tab)
  • Type in your username and password for your WordPress blog and the URL for your blog – if your blog is at http://www.thegeeksclub.com/ you should enter http://www. thegeeksclub.com/xmlrpc.php (The xmlrpc.php is important thing here. If you miss this step then this extension will not work)
  • If your theme doesn’t support Post Formats, you’ll need to set a category for your links. From your WordPress dashboard create these categories first. Click ‘advanced options‘ and type the category name. Then save.
  • (This is optional) if you wish your links to be pages, rather than posts, type ‘page’ into the post type box.
  • Now the process completed and you will be ready to save the bookmarks.

If you found a web site you wish to save a link to, then click on the new icon (something like WordPress logo) in your toolbar, then fill out a title (optional – defaults to the link of the page), fill out some tags (optional, but recommended) and click ‘Save Link’.

Now check your posts. There you should have a new one. If you don’t, visit your WordPress ‘writing’ settings page (log in to WP, Settings > Writing) and ensure that “Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.” is checked.

I hope this tutorial helped you to save the bookmarks to your WordPress Blog.

Stay tuned on The Geeks Club for more WordPress tips and tutorials.

by -

Object oriented programming is something that scares many beginners and young programmers. If you are a first year computer science student then make sure you learn this stuff well because object oriented programming is something you are going to deal all through, in fact mostly in your programming life.

This tutorial aims to teach the basics of object oriented programming. It is designed for the students who have some knowledge about procedural programming. And it is tailored specifically for PHP programming language. Probably the most important think I would like to take away from this tutorial is the idea of object oriented as it requires a new way of thinking.  Let’s get started

What is object oriented programming in PHP?

Well object oriented PHP or some may call it as OOP in PHP is very much similar to object oriented programming in JAVA and C++. Looking at a object oriented code it looks far more complicated and complex than a procedural or inline programming code. But the truth is OOP is simple and straight forward and better way to program.

Like any other programming language object oriented PHP follows the rules of creating “classes” and there “objects”.

Right of the bat, there is a huge confusion between objects and classes. So what exactly is the difference then?

What are classes in PHP?

A class is something like a blue print of a house on a paper. It is the layout of the entire house, the size, the dimensions and much more. This blueprint or the class also explains the interconnection and relations between different parts of the house. Similarly classes in PHP are collection of different methods and objects.

What are objects in PHP?

It might be clear from the above definitions of the class, now an object in PHP is something like a house.  An object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure. It also refers to a particular instance of a class.

Creating a class in PHP

To create a class in PHP you have to follow its syntax and it is straightforward, Just use ‘class’ keyword followed by class-name(user defined).

class Website
// Variables

After creating the class, you need to instantiate the class, which is done using ‘new’ keyword. This object is called a Instance of a class.

$obj = new Website;

 Creating methods for a class in PHP

Like any other programming language PHP allows you to define methods in a class. These methods can only be accessed through the instance of this class created or inheriting class, which you will study later in the concept of inheritance.

Here is an example to explain you class definition, instantiation and its usage.

// class definition
class Website
// method definition

public function display($name)
$website = “thegeeksclub”;
// object creation for a class

$obj = new Website;
// method call
echo $obj->display($website);

To access the functions of a class, use  ” -> ” operator along with the method or function name.

$obj -> display($name);

Check out the other tutorials on PHP as well :

PHP Tutorial 1: Introduction for Beginners
PHP Tutorial 2: PHP Script Syntax and HTML File Compatibility
PHP Tutorial 3: Variables in PHP
PHP Tutorial 4: Control Statements
PHP Tutorial 5: Functions
PHP Tutorial 6: Form Processing
PHP Tutorial 7: $_POST and $_GET Functions
PHP Tutorial 8: Connecting PHP script to MySQL
PHP Tutorial 9: PHP insert statement
PHP Tutorial 10 : PHP Session
PHP tutorial 11: Uploading a file to the server

by -

In tutorial 13, we made For Loop go round the execution cycle for number of times specified by Start and End variables. Now imagine a case where we are not sure how many times we want to rotate loop. For Example, a case where we have given rights to the user to put how many number of rotations but at the same time we want some control over the maximum limit. In such scenario, Do loop works best than that of For loop. An example will clear things better.

There is a very little difference between For and Do and to understand it, create a form as shown below:

Now click on the button and put the following code in it:

Dim number As Integer
 number = Val(txt_EndLimit.Text)
Do While number < 6
 number = number + 1

Now run the program to see what is output. You must get output as follows:

Pressing on OK will provide us with next MsgBox. In this way, Do loop can go round and round when we are not sure of what is value of number of rotations. Now lets change our code a bit as follows:

 number = number + 1
 Loop While number < 6

There is no certain difference between output, isn’t it? But using While with Loop makes above part of code execute at least once immaterial if it satisfies condition stated in While. Apart from using Do…While combination, we can also use Do…Until, where loop keeps on rotating UNTIL certain condition is met. We can design various applications using these two applications. Certainly use of If…Else is an alternative for Loops in VB.net but using Loops reduces irksome task of coding thousands of line.

by -

To stay in loop means to repeat some task again and again. For Loop, Do Loop and While…End While Loop in VB.Net serves similar purpose. Suppose someone tells you to add numbers 1 to 3 and display them using MsgBox. You would write a simple code as

Dim Total As Integer
Total = 1 + 2 + 3
MsgBox (Total)

But now guess a scenario where similar guy tells u to add numbers from 1 to 111; then are you going to write down each and every number? Obviously not! In this case loops provide us simple functions that can be used to do single operation, like adding in this case, several number of times.

Now as our each tutorial proceeds, create a form first with button and textbox in it. Double click on the form and put the following code:

Dim A As Integer
 Dim Answer As Integer
For A = 1 To 3
 Answer = Answer + A
Next A
 txt_Loop.Text = Answer

Run the above code and click the button. Answer, which is addition of 1+2+3, as 6 will appear in textbox.

Let’s break down the code. Word “For” at the start of the loop tells VB about type of loop we are going to use. We want integer A to loop and thus we define start value for it in the next line. Similarly, we tell VB where to end the loop operation. In short, we are creating a loop of finite rotations. Line of code “Next A” is used to tell VB that we are looking for next number from the loop value set. “Next” redirects execution to word “For” as it is in loop. When next value of A is going out of limit that we have stated, loop breaks and final result is displayed to user.

You can even use For Loop to display one number after another by using following code:

Dim Start As Integer
Dim End As Integer
Dim Total
For Total = Start To End
MsgBox (Total)

By now if you have followed tutorials perfectly, you must have understood how to get values from user for Start and End variables. Have you got any ideas to play with For Loops? Let us know by commenting below.

by -

RAM (Random Access Memory) as we all know is very important for a PC’s functioning. Instructions are executed out of memory, so your computer cannot operate without it. And when a thing so important gets problematic, you need a heart of a lion to get into action. This article should help you out in such a situation.

RAM failure Symptoms

RAM failures are easy to detect. There are some things that go wrong everytime when memory modules fail

  1. Frequent BSODs appear on your screen during bootup.
  2. Heavy applications take huge amount of time to start and work slow and crash frequently.
  3. Games show up error messages for memory problems
  4. After booting into the desktop, your PC takes 10 minutes to start functioning normally
  5. PC restarts for no reason at all!

If you’re experiencing most of these symptoms, your memory can be at fault. And it needs immediate attention. By immediate, I mean IMMEDIATE!

Troubleshooting RAM failure

  1. MemTest86+ Test - Run a test using a tool called MemTest86+. It is found on LiveCDs of many distributions of Linux including Ubuntu and Linux Mint. It will scan for errors on your memory. The test takes a long time, so leave it overnight. Check the results to decide whether the memory is at fault or not. You can learn more about it here.
  2. Switch Places - Open your PCs cabinet. Try inserting the RAM into alternate slots on your motherboard.
  3. Clean Up-  Clean the contacts of the memory(The pins that go in) with Contact Clean which is available locally at PC shops
  4. Underclock - If you’ve overclocked your memory, restore it back to factory settings.
  5. Memory Timings - If you’ve messed with the memory timings and voltage, its time to revert back.
  6. Windows Memory Diagnostic - If you use Windows 7 or Vista, try it out the Windows Memory Diagnostics Tool.

If everything fails, try and get a module from your friend and insert it into the slot. If the PC works fine, then your RAM’s dead. Buy a new one, it is quite inexpensive. And if it doesn’t work contact your hardware vendor.

by -

First we will discuss return type of any method. Then we will see the control flow from invoking code to invoked code and again when control goes back to invoking code. After learning about method overloading and constructor overloading in Java, the content of Java object methods will be easier.

A method returns to the code that invoked it when it:

  1. completes all the statements in the method,
  2. reaches a return statement, or
  3. throws an exception (covered later)

Whichever occurs first between the last two.

You declare a method’s return type in its method declaration. Within the body of the method, you use the return statement to return the value.

Any method declared void doesn’t return a value. Meanwhile it does not require to contain a return statement, but if you wish to put you can.  In such a case, a return statement can be used to branch out of a control flow block and exit the method and is simply used like this:


If you try to return a value from a method that is declared void, you will get a compiler error.

Any method that is not declared void must contain a return statement with a corresponding return value, like this:

return returnValue;

So far it was a recapitulation what we know earlier.

Now we will learn how to return object after a method call. It seems to be strange. But its true that A method can return any type of data, including class types that you create.

We will understand how it happens with the following example given below.


class Employee{
  double salary;
  Employee(double salary){
    this.salary = salary;
  Employee updateSalary(double salary){
    Employee employee = new Employee(this.salary+salary);
    return employee;
  double getSalary(){
    return this.salary;
class ReturnObjectDemo{
  public static void main(String args[]){
    Employee kallis = new Employee(34029.48);
    Employee ronaldo;
    System.out.println("Salary of Kallis is: "+kallis.getSalary());
    System.out.println("Salary of Ronaldo is: "+ronaldo.getSalary());



Explanation of the Java Code & Output

As you can see, each time updateSalary( ) is invoked, a new object is created, and a reference to it is returned to the calling routine. The preceding program makes another important point: Since all objects are dynamically allocated using new, you don’t need to worry about an object going out-of-scope because the method in which it was created terminates. The object will continue to exist as long as there is a reference to it somewhere in your program. When there are no references to it, the object will be reclaimed the next time garbage collection takes place.

Here object ronaldo of class type Employee is created when updateSalary() is being invoked by the object kallis of Employee class. But the point that is to be noticed that is both even though ronaldo is created from object kallis but both will have separate copies of instance variables.

Checkout more useful tutorials and definitive guidelines on Java programming here.

by -

We have already discussed all about Java constructors in our previous tutorial and we have also discussed different types of constructors viz. Default Constructor, Parameterized Constructor and Copy Constructor. Before we delve into the details of constructor overloading we will recapitulate constructor once again.

Recapitulate Constructor

  • Constructors are used to assign initial values to instance variables of the class immediately upon object creation.
  • Constructor is always called by new operator.
  • A default constructor with no arguments will be called automatically by the Java Virtual Machine (JVM).
  • Constructors are declared just like as we declare methods, except that the constructor doesn’t have any return type.

What is Constructor Overloading in Java

When the constructors have same name with different arguments (may differ in number/type/sequence of arguments), so called Constructor Overloading.


  • In a class, the concept of constructor overloading does not allow the external user to be aware about the internal processing of the system.
  • Overloaded constructors differ in either number of parameters or type of parameters or sequence of parameters.
  • JVM differentiates constructors on the basis following criteria
    1. Number of Parameters.
    2. Type of Parameters.
    3. Sequence of Parameters.
  • Constructor overloading, allows the user to achieve the compile time polymorphism.


class Figure{
  double width;
  double height;
  double depth;
  /* Default Constructor */
    width = -1;
    height = -1;
    depth = -1;
  /* Parameterized constructor when all the dimensions are specified */
  Figure(double width,double height,double depth){
    this.width = width;
    this.height = height;
    this.depth = depth;
  /* Parameterized constructor to calculate volume of Cube */
  Figure(double length){
    width = height = depth = length;
  /*Copy Constructor */
  Figure(Figure fig){
    width = fig.width;
    height = fig.height;
    depth = fig.depth;
  /* Method to calculate Volume */
  double volume(){
    return width*height*depth;
class CalculateVolume{
  public static void main(String args[]){
    Figure fig = new Figure();
    Figure pp = new Figure(2,3,4);
    Figure cube = new Figure(3);
    Figure box = new Figure(pp);
    System.out.println("Volume of default Figure is: "+fig.volume());
    System.out.println("Volume of Parallelopiped is: "+pp.volume());
    System.out.println("Volume of Cube is: "+cube.volume());
    System.out.println("Volume of Box is: "+box.volume());



Explanation of the Java Code & Output

Here in class Figure, constructor Figure() are overloaded with different arguments in order to initialize instance variables to calculate volume of those geometrical figures. In class Figure we have defines one default constructor to initialize all the instance variables with some default values. Here it is -1. Next two constructors are parameterized constructors where in the first constructor all the dimensions are specified and in the second one dimension for cube is specified. Last one is the copy constructor whenever we need any figure which may be the as same as any of the existing figure. Then we can use this constructor to initialize the dimensions of the figure we will have to create. Thus during object creation JVM differentiates all these overloaded constructors on the basis of resolution criteria mentioned above in the properties.

One more fundamental I would like to recapitulate is being declared parameterized constructor and without declaring default explicitly if you want to create object of that class with default constructor  of that class you will get an error as when you declare parameterized constructor at that time JVM doesn’t provide default constructor from its own. You have to explicitly provide the default constructor while providing parameterized constructor in order to avoid any instantiation error.

N.B: Automatic data type conversion is true for constructor overloading also. This conversion is true for lower datatype( e.g int) to higher datatype (e.g double) conversion not for the reverse (double to int).

Next we will learn about how to return objects from Java methods.

Checkout more useful tutorials and definitive guidelines on Java programming here.

by -

Before moving to the most important part in any programming language, conditional statement, lets take a quick look at ComboBox. ComboBox works like Select Case but instead of typing input, users select it from the list of items provided in ComboBox. To work with it, add one ComboBox and a button from toolbar and name ComboBox as cmb_Club. Your form should look like this one:

Now click on the ComboBox properties and locate “item” property. It will have attribute as “Collections” written in front of it. Here is a quick look at property tab of ComboBox.

Click on Collections and a windows with empty space will open. Put alternatives there that you are willing to provide to users. Like we have listed some clubs from English Premier League. For adding multiple options, list them one below another.

Now save the list and double-click on button to add following code.

Dim Club As String
Club = cmb_Club.Text

Run the program and check if your ComboBox is working.  If it isn’t, let us know by commenting below so that we can resolve your problem.

As we have seen in many tutorials from this series, for comparison purpose or to put up some condition, we have used operators like greater than (>) or less than (<) or equal (=). These operators are known as conditional operators and they play a vital role in most of programming languages. Here is a table that represents which operator performs which function.

Operator Meaning Syntax
> Greater Than If sum >10Then MsgBox (String/Number)
< Less Than If sum<10Then MsgBox(String/Number)
>= Greater Than or Equal To If sum>= 10Then MsgBox(String/Number)
<= Less Than or Equal To If sum<= 10Then MsgBox(String/Number)
And Used to “And” two conditions If sum>10 And sum<20Then MsgBox(String/Number)
Or Used to “Or” two conditions If sum>10 Or sum<20Then MsgBox(String/Number)
<> Not Equal To If sum<>10Then MsgBox(String/Number)

 Here we have used variable “sum” for displaying result. All the operators can be used with provided syntax. All operators are self-explanatory. Our readers might face difficulty in using “And” and “Or”. When we use “And” operator in code, it means that both conditions must be satisfied for result to be true while in case of “Or” operator either of condition can display result. Code for the operators can be added to the button. We want you to work on these operators by adding different buttons for each operator.

If you are facing any difficulty, let us know.