ITSourceCode.com

Free Source Code and Tutorials

Custom Search

Category: Java

Final Keyword in Java

Final keyword in Java can be used with class, object, method and variables. It is used in order to restrict the user. If final keyword is used along with the class, then that class cannot be extended. If final keyword is prefixed before method then we will not be able to override that method. If […]

Share this

Method Overriding in Java

Method Overriding If subclass/child class has the same method as declared in the super/parent class (signature of method in both class should be same), it is known as method overriding in java. In other words, If subclass provides the specific implementation of the method that has been provided by one of its parent class, it […]

Share this

Basic concepts of JAVA

Today I m going to  tell you the basic concepts   of JAVA . First of all,a Java program can be considered as a bunch of Objects which uses or invokes methods(functions) to communicate among them. Let us see what these objects and methods consist of: 1. Object -an object has their  own states and […]

Share this

Main Method Overriding in Java

Many of the folks who are new to Java thinks that compiler will throw error if we are going to override main method in java. But, we can override main method in Java. But we can’t change the method signature. Here is an example: < View plain text > java class A{ public static void […]

Share this

How to avoid class cast Exception in Java?

Many time we might see class cast exception while execution of our code. In order to avoid this exception we need to use instance of operator in our code. Let us take one example: < View plain text > java //Here A, B, C and D are four classes   class Manager{ public static void […]

Share this

Polymorphism in Java

Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic. In polymorphism, two things […]

Share this

Final object in Java

Subject: Final Object in Java We cannot reinitialized Final Objects in Java. For Example: See the below code < View plain text > java class P{   int i ;   }   class Manager{   public static void main(String args[]) {   final P p1=new P();   P.i=10; //modifying i not p1 , allowed […]

Share this

Difference between String class and String Buffer/ String Builder class in Java

  Subject: In this post we will learn , difference between String class and String Buffer/ String Builder class in Java. String objects are immutable while String Buffer objects are mutable. String temp1=” Rahul”; String temp1=”Rahul”+”Tiwari” ; System.out.println(temp1); Here, output will be Rahul Tiwari. But two objects will be created. In String class, toString, equals […]

Share this

Difference between String Buffer and String Builder

Subject: In this article we will learn difference between String Buffer and String Builder String Buffer was introduced in JDK 1.0 and it is synchronized. This means two or more threads cannot execute at a time String Buffer object. On the other hand, String Builder was introduced in JDK 1.5 and it is non synchronized. […]

Share this

In this tutorial we will learn JDBC INSERT statement

Subject: In this tutorial we will learn JDBC INSERT statement Inserting data into a SQL database table is a simple two-step process: First we need to create a Java Statement object. Post creation of Java Statement object we need to execute a SQL INSERT command through the JDBC Statement object. If anyone is aware of basic […]

Share this
Page 4 of 41234
ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!