• Java String Builder

    Java String Builder class is used to create mutable (modifiable) string. The String Builder class is same as StringBuffer class except that it is non-synchronized. It is available since JDK1.5. Commonly used Constructors of String Builder: StringBuilder(): creates an empty string Builder with the initial capacity of 16. StringBuilder(String str): creates a string Builder with the […]

    Posted in: Java

  • Inheritance

    Inheritance Java Inheritance defines an is-a relationship between a superclass and its subclasses. This means that an object of a subclass can be used wherever an object of the superclass can be used. Class Inheritance in java mechanism is used to build new classes from existing classes. The inheritance relationship is transitive: if class x […]

    Posted in: Java

  • Java Inner Class

    Java Inner Class Inner classes are class within Class. Inner class instance has special relationship with Outer class. This special relationship gives inner class access to member of outer class as if they are the part of outer class. Note: Inner class instance has access to all member of the outer class(Public, Private & Protected) […]

    Posted in: Java

  • Collection in Java

    Collection in java Collection Framework has been added in JDK 1.2 and has been expanded in 1.4 -1.6 Interface & Classes of Collection Framework Collection  in java is a  API provides a group of interface to choose from, but it also gives you some concrete classes to directly play with. Core Interfaces Collection List Set SortedSet(Extends […]

    Posted in: Java

  • Java Exceptions

    Exceptions Exception are used in Java to handle errors or any other exceptional event that occurs in the normal flow of program. There are several way Exception can occur in Java. Data provided is not in expected format(eg. int instead of String). DB can not connected. Network connection Lost. Object is null. Java Exception Hierarchy […]

    Posted in: Java

  • Override

    Override Class inheriting the method from its super class has the option to override it. Benefit of overriding is the ability to define behaviour specific to particular class. Method Overriding Example

    Method Override Rules Overriding method can not have more restrictive access modifier than the method being overriden but it can be less. The […]

    Posted in: Java

  • Overloading

    Java Overloading Overloaded method gives you an option to use the same method name in a class but with different argument. Method overloading is a controversial language feature, especially in the context of Object Oriented languages, where its interaction with overriding may lead to confusing semantics. One of the main arguments against overloading is that […]

    Posted in: Java

  • Java Interface

    Interface Creating an Interface means defining a Contract. This Contract states what a class can do without forcing how it should do. Declaring an Interface Interface can be defined with Interface keyword. Java Interface Example

    Rules for Declaring Interface There are some rules that needs to be followed by Interface. All Interface methods are […]

    Posted in: Java

  • Static Keyword

    What is Static Static is a Non Access Modifier. Applicable to Static keyword can be applied on Method Variable Class nested within another Class Initialization Block Not Applicable to Static keyword can not be applied to Class (Not Nested) Constructor Interfaces Method Local Inner Class(Difference then nested class) Inner Class methods Instance Variables Local Variables […]

    Posted in: Java

  • this keyword

    What is this this is a keyword in Java. Which can be used inside method or constructor of class. It(this) works as a reference to current object whose method or constructor is being invoked. this keyword can be used to refer any member of current object from within an instance method or a constructor. this […]

    Posted in: Java