Base and Derived Class Constructor

As derived class inherits all the base class members, hence derived class objects executes the base class constructor. Base class constructor is not inherited by derived class constructor, however derived class constructor can call base class constructor. Points to Remember: When creating the derived class object the base class constructor is called first and then the derived class constructor is called. Example: Check on Inheritance in Java Topic.

Continue reading »

Inheritance in Java

Inheritance is an object-oriented programming technique. If you need a class similar to previous one with new additional features, java allows you to use the members of the existing class and add some more features to the new class. It is done by inheritance. The class which you derive is super class, base class or parent class. The class which is derived is sub class, derived class, child class. How to create Derived class, Syntax for creating derived class, class sub_class_name extens base_class_name { }…

Continue reading »

Strings in Java

Strings are represented as Objects in Java. Strings in Java are String and StringBuffer class. String classes have extensive runtine checking, which helps to eliminate troublesome runtime errors. [table] String,Represents constant strings,string length cannot be varied StringBuffer,Represents variable strings,string length can be varied [/table] Example of String Class: //String class example in CodeParent.com public class Name { public static void main(String[] args) { // TODO Auto-generated method stub String n1 = new String(“CodeParent”); String n2 = new String(“made Java easy”); System.out.println(“String in n1 :”+n1); System.out.println(“String…

Continue reading »