• 27 April

    Abstract class in java

    An abstract class is the class which is declared abstract and can have abstract or non abstract methods. An abstract class can not be instantiated. It can be extended by subclass to implement abstract methods and either use or override concrete methods. Abstract method in java Abstract method is the method which do not have […]

  • 27 April

    Interface in java

    In previous post, we have seen abstract class in java which provides partial abstraction. Interface is one of the core part of java and is used to achieve full abstraction. Interface is generally used to provide contract for class to implement. Interface do not have implementation of any method.A class implements an interface, thereby inheriting […]

  • 26 August

    Copy Constructor in java

    In this post, we will see about copy constructor in java. Copy constructor is the constructor which takes parameter as object of same class and copy each field of the class to the new object. Unlike C++, java does not provide default copy contructor. You need to create one, if you want to have copy […]

  • 26 August

    Java default constructor

    In this post, we will see about Java default constructor. Default constructor is the no arg constructor which is inserted by compiler unless you provide any other constructor explicitly. You won’t able to see it as it is present in class file rather than source file. Is there any difference between no argument constructor and […]

  • 28 May

    Constructor in java

    Constructor in java is block of code which allows you to create instance of the object. It does not have return type. It has two main points Constructor name should be same as class Constructor should not have any return type else it will be same as method. There are three types of Constructor in Java. […]

  • 27 April

    Comments in java code

    Comments are the essential part of code. If you write good comments, it will be easier for others to understand the code. Comments are ignored by the compiler when it compiles the program. There are three types of comments in java code. Single line comments Multi-line comments Java doc comments Single line comments: These are […]

  • 13 April

    Java break statement example

    Break statement is one of the different control statements which we use very often. If break statement is found in loop, it will exit the loop and execute the statement following the loop. Let’s take very simple example: Java break statement example You want to search for the element in an array and if element […]

  • 12 April

    Java continue statement example

    continue statement is one of the different control statements which we use very often.If continue statement is found in loop, it will continue the current iteration and will not execute statements following continue statements. It is generally used to skip current iteration on the basis of some condition. Let’s take very simple example: Java continue […]

  • 27 April

    Switch case in java

    Switch case in java is alternative to if else if ladder. It is used to execute statements based on some conditions. Syntax of Switch case in java [crayon-614cbbf81c59d060664961/] Let’s understand it with the help of simple example. We are going to print weekday based on integer. 0 represents Sunday, 1 represents Monday and so on.. […]