So in my previous post which is on
overriding in java I mentioned that static methods can’t be overridden .Yes,
its true that we cannot override static methods .But hold on when I tried the
following program it worked :
package test;
import java.util.ArrayList;
import java.util.List;
class...
Blog for Java,CoreJava,Collections Framework,Java Interview Questions ,Top Java Interview Questions ,Collections Interview Questions ,Java Programs,Android tutorial,Android Studio
Saturday, 27 September 2014
Friday, 26 September 2014
Overriding in java
Meaning of overriding :
Overriding concept is associated with Inheritance . If we have 2 classes ,one extending the other then child class can override methods of parent class . But there are some rules which needs to be followed :
So we will see which are all these rules :
Rule 1 : The signature...
Thursday, 25 September 2014
How to sort and reverse an array list without using sort method
package test;
import java.util.ArrayList;
import java.util.List;
public class testing {
public static void main(String[] args) {
List<Integer> l= new ArrayList<Integer>();
l.add(1);
l.add(7);
l.add(90);
l.add(67);
int temp;
for (int i = 0; i < l.size(); i++) {
for (int j =0 ; j <...
Serialization in Java
Meaning of serilization in java
Serialization means converting an object data into byte stream so that it can be easily transfer through network.
It means its mechanism of translating objects values/state to bytes to send it over the network and same ay deseriablzation is coverting those bytes...
Can a class be static in java?
Static class in java :
Static class in java :
YES, we can have static classes in java like we've got static variables and static method and static things are related to the complete class not with an object of a class.
Similarly ,static classes can even be related to another class. therefore...
Wednesday, 24 September 2014
If we are using both constructor and Setter method of a bean to set property of a bean class then with which value it will be set , with value given in constructor or setter method ?
Ans : With value given by setter method.
Reason : Because constructor will be invoked at the time of object creation but setter method will be invoked after that ,so due to which value of setter method ll override value given by constructor .
Eg. We have bean class Student
Class Student
{
Private...
Monday, 22 September 2014
Internal Working of Array List
ArrayList works on the principle of creating a array and adding elements to it.
ArrayList class has a member variable elementData which is a Object array;
Object[] elementData;
When we do List l = new ArrayList(); the array elementData is initalized with a size of 10
if you use List...
Saturday, 20 September 2014
Difference between JSP include directive and JSP include action
JSP include directive
JSP action directive
<%@ include file=”filename”...
Tuesday, 16 September 2014
JDBC Basics – Java Database Connectivity Steps
Before you can create a java Jdbc connection to the database, you must first import the
java.sql package.
import java.sql.*; The star ( * ) indicates that all of the classes in the package java.sql are to be imported.
1. Loading a database driver
In this step of the jdbc connection process,...
JDBC Tutorial
JDBC -An introduction
The JDBC ( Java Database Connectivity) API defines interfaces and classes for writing database applications in Java by making database connections.
Using JDBC you can send SQL, PL/SQL statements to almost any relational database.
JDBC is a Java API for executing...
Monday, 15 September 2014
Throw Keyword , Throws Keyword and Difference between Throw and Throws
Throw keyword:
Throw keyword is used to throw an exception explicitly.
An exception, either a newly instantiated one or an exception that you just caught. by using the throw keyword.
Throw Example in Java :
import java.io.*;
public class className
{
public void deposit(double...
Exception Handling in Java
@font-face { font-family: Century; src: url('GOTHIC.ttf'); }
body{ font-family: Century; background: rgb(51,51,51) url("wallpaper.jpg"); color: #fff; padding:20px; }
.pagina{ width:auto; height:auto; }
.linha{ width:auto; padding:5px; height:auto; display:table; }
.tile{ height:100px;...
Saturday, 13 September 2014
Exception ,Types of Exception , Its Handling
Exception Handling
What is Exception
Exception is an abnormal condition.
In java, exception is an event that disrupts the normal flow of the program. It is an object which is thrown at run time.
Exception Handling
The core advantage of exception handling is to maintain the normal flow of...
Subscribe to:
Posts (Atom)