Hub Of Geekz

  • Home
  • About Me
  • Contact Us
  • Home
  • Languages
    • C++
    • Java
    • Perl
    • Prolog
    • Bootstrap
  • Database
    • SQL
    • PL/SQL
  • Study
    • Java
      • Java Collection
      • Java Concurrency
      • Java Interview Questions
      • Java Networking
    • Number System
  • Kavita
  • Entertainment
    • Hinglish Cafe
    • Videos
    • Jokes
  • Windows Tricks
  • How To

Thursday, 12 March 2015

ArrayList Methods in Java

 Earthcare Foundation NGO     10:14     Collection, Java     No comments   

In this pots i will explain some methods of ArrayList.
1)clone:This method is used to make a exact copy of list.This method returns object so we need to add casting to it.
Suppose list is an ArrayList and we have added some elements to it.

ArrayList<String> list=new ArrayList<String>();

list.add("First List");

list.add(1, "I");

list.add(0, "Abhishek");

So apply clone method on it
ArrayList<String> list1=new ArrayList<String>();
list1=(ArrayList<String>) list.clone();//to get the exact copy

2)clear():This method is used to clear the list means all the data present in the list will be lost and list will become empty.
list.clear();

3)contains():This method accepts object as argument to chech whether it is present in the list or not.It returns true if element is present else returns false.
boolean exist=list.contains("Abhishek");

4)containsAll():This method accepts collection as its argument and checks all the elements with the current collection to check whether every element in both of these collections are same or not.If every element is present then it returns true else returns false.
exist=list.containsAll(list1);
Note:The presence of elements of passed list is searched.
for example in above statement if list contains all the elements which are present in list1 then it will return true.It will not check the presence of all elements of list in list1.
The whole concept explained above is explained in the following program:

package examples;

import java.util.ArrayList;

public class ArrayListOther {

public static void main(String[] args) {


ArrayList<String> list=new ArrayList<String>();
System.out.println("This is an example of add method in ArrayList");
list.add("First List");
System.out.println("After adding elements list is "+list );
list.add(1, "I");
System.out.println("After adding elements list is "+list );
list.add(0, "Abhishek");
System.out.println("After adding elements list is "+list );

ArrayList<String> list1=new ArrayList<String>();
list1=(ArrayList<String>) list.clone();
System.out.println("The cloned list of list is "+list1);

boolean exist=list.contains("Abhishek");
System.out.println("List contains element Abhishek: "+exist);
list.add("hello");
exist=list.containsAll(list1);
System.out.println("List contains all elements of other list : "+exist);

list.clear();
System.out.println("After removing all the elements using clear method list is"+list);

}

}

Output:
This is an example of add method in ArrayList
After adding elements list is [First List]
After adding elements list is [First List, I]
After adding elements list is [Abhishek, First List, I]
The cloned list of list is [Abhishek, First List, I]
List contains element Abhishek: true
List contains all elements of other list : true
After removing all the elements using clear method list is[]

In the above example you can see that after cloning list and list1 both contains same elements and after that i have added another element in list and after that i have called list.containsAll(list1) and it is returning true since elements if list1 will be checked in list.
So till now i have explained some methods of ArrayList class.Hope you are able to understand.If there is any problem then you can ask me by comment or email.
Thanks
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

ArrayList Methods in Java

 Unknown     10:09     Collection, Java     No comments   

In this method i will explain some methods of ArrayList which are used frequently.

1)ensureCapacity():This method is used to increase the size of the ArrayList,if necessary to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
   
    list.ensureCapacity(30);
By above statement the minimum capacity of the list will be 30.

2)get(index):This method is used to get the element at the specified index.If index<0 or index>sizeOfList then IndexOutOfBoundsException will occur.

    list.get(2);
This will return element present at index 2.Again if we will put any index which is not in list then exception will occur:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 5, Size: 4
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at examples.ArrayListMethods.main(ArrayListMethods.java:23)


3)hashCode():
This method returns the hash code of the given list.
    list.hashCode();
    output:1351734790


4)indexOf(object):This method searches for the specified object and returns the index of first occurence of that object.If object is not present in the list then it returns -1.
    list.indexOf("Brown");   
This will return 3.

5)isEmpty():This method is used to test whether the list is empty or not.If the list is empty it will return true.
    list.isEmpty();

Program Code:
package examples;

import java.util.ArrayList;

public class ArrayListMethods {

    public static void main(String[] args) {


        ArrayList<String> list=new ArrayList<String>();
        System.out.println("This is an example of add method in ArrayList");
        list.add("First List");
        list.add("Orange");
        list.add("Red");
        list.add("Brown");
        System.out.println("After adding elements list is "+list );
   
        list.ensureCapacity(30);
       
        String str=list.get(3);
        System.out.println("Element at index 3 is: "+str);

        System.out.println(list.hashCode());
        int loc=list.indexOf("Brown");
        if(loc>=0){
            System.out.println("The element Brown is present at location "+loc);
        }
        else{
            System.out.println("The element Brown is not present in the list");
        }
       
        System.out.println("List is Empty: "+list.isEmpty());
    }

}

Output:
This is an example of add method in ArrayList
After adding elements list is [First List, Orange, Red, Brown]
Element at index 3 is: Brown
1351734790
The element Brown is present at location 3
List is Empty: false

So above is all about some methods of ArrayList which can be used for convenience.If there is any query ask me via comment or email.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Tuesday, 10 March 2015

ArrayList in Java

 Earthcare Foundation NGO     10:14     Collection, Java     No comments   

Java API provides several predefined data structure which are also known as collections in Java.ArrayList is a collection which we can use conveniently in place of array because when we are using array there is a problem that array size cannot be changed automatically at runtime i.e. if we are using an array and it became full then it will throw an exception instead of increasing its size.This problem can be solved by using ArrayList.There are also other benefits as there are lot of inbuilt methods which are convenient to use for adding element,deleting an element,searching an element etc.List can also contain null and duplicate elements.So lets get some knowledge of methods of ArrayList.
1)add(element):This method is used to add an element at the last position of ArrayList.This is an efficient method to add an element in ArrayList.
2)add(index,element):This method is used to add an element at the specified position in the ArrayList.This method is not so much efficient as the elements after that position have to shift one position.
for ex list=2,3,6,7
list.add(2,56); //add 56 at 2nd position
 then list=2,3,56,6,7
So whenever possible use add(element) method for efficeincy.
3)addAll(Collection<?extends E>):This method is used to append all the elements of other collection at the end of the list.
4)addAll(index,Collection<?extends E>):This method is used to append all elements of other collection at specific position in the list.

Program Code:
package examples;

import java.util.ArrayList;

public class ArrayListExample {

public static void main(String[] args) {

ArrayList<String> list=new ArrayList<String>();
System.out.println("This is an example of add method in ArrayList");
list.add("First List");
System.out.println("After adding elements list is "+list );
list.add(1, "I");
System.out.println("After adding elements list is "+list );
list.add(0, "Abhishek");
System.out.println("After adding elements list is "+list );
System.out.println("List can also contain duplicate elements");
list.add("I");
System.out.println("After adding elements list is "+list );

ArrayList<String> list1=new ArrayList<String>();
list1.add("Second List");
System.out.println("After adding elements list is "+list1 );
list1.addAll(list);
System.out.println("We can append other list to this list");
System.out.println("After appending other list, elements of list are "+list1 );

ArrayList<String> list2=new ArrayList<String>();
list2.add("Third List");
list2.add("Hello");
System.out.println("We can also insert other list at specific location");
list2.addAll(1, list1);
System.out.println("After appending other list, elements of list are "+list2 );

}

}

Output:
This is an example of add method in ArrayList
After adding elements list is [First List]
After adding elements list is [First List, I]
After adding elements list is [Abhishek, First List, I]
List can also contain duplicate elements
After adding elements list is [Abhishek, First List, I, I]
After adding elements list is [Second List]
We can append other list to this list
After appending other list, elements of list are [Second List, Abhishek, First List, I, I]
We can also insert other list at specific location
After appending other list, elements of list are [Third List, Second List, Abhishek, First List, I, I, Hello]
So above are some methods to add elements in the ArrayList.
Hope everything is clear,if not then ask me via comments or email
Thanks.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Arrays Class in Java

 Earthcare Foundation NGO     10:11     Java     No comments   

In this post i will explain about the Arrays class in Java which is inbuilt and we can use many predefined methods on this Array class which makes our problem simple.
1)sort():This method is used to sort the array elements.
2)equal():This is a method for comparing two arrays.
3)binarySearch():This is a method to find an element using binary search.This method returns the location of the element.
4)fill():This is a method to assign specified value to each element of specified  array.
Arrays.fill(arr,7);
where arr is an array of type integer,then it will replace all the elements in the array with 7.
5)arrayCopy():This is a method by which we can copy elements of one array to another.

Program Code:

package examples;

import java.util.Arrays;

public class ArraysClass {

public static void main(String[] args) {

int[] arr={2,5,3,6,8,65,23,45};
System.out.println("Elements of arr are ");
for(int element:arr){
System.out.println(element);
}
Arrays.sort(arr);
System.out.println("Sorted array is ");
for(int element:arr){
System.out.println(element);
}
int[] arr1=new int[6];
Arrays.fill(arr1, 7);
System.out.println("Elements of array after insertion  are ");
for(int element:arr1){
System.out.println(element);
}
int [] arr2={1,4,6,8,9};
System.out.println("Elements of arr1 are ");
for(int element:arr2){
System.out.println(element);
}
System.arraycopy(arr2, 0, arr1, 0, arr2.length);
System.out.println("Elements of arr1 after copy ");
for(int element:arr1){
System.out.println(element);
}
int loc=Arrays.binarySearch(arr2, 3);
if(loc>=0){
System.out.println("Element 3 is found in arr2 at location "+(loc+1));
}else{
System.out.println("Element 3 is not present in the arr2");
}
loc=Arrays.binarySearch(arr2, 4);
if(loc>=0){
System.out.println("Element 4 is found in arr2 at location "+(loc+1));
}else{
System.out.println("Element 4 is not present in the arr2");
}
boolean equ=Arrays.equals(arr, arr1);
if(equ){
System.out.println("Both array arr and arr1 are same");
}else{
System.out.println("Arrays arr and arr1 are not same");
}
}

}

Output:
Elements of arr are
2
5
3
6
8
65
23
45
Sorted array is
2
3
5
6
8
23
45
65
Elements of array after insertion  are
7
7
7
7
7
7
Elements of arr1 are
1
4
6
8
9
Elements of arr1 after copy
1
4
6
8
9
7
Element 3 is not present in the arr2
Element 4 is found in arr2 at location 2
Arrays arr and arr1 are not same

One thing to note here is that in method,
System.arraycopy(srcArray,startIndex,dstArray,startIndex,length);
if we provide length which is larger than srcArray then we will get an ArrayIndexOutOfBoundsException.
So above is all about Arrays class in Java.If there is any query let me know by comments or by email.
Thanks.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Interview Question-Variable length arguments to method

 Earthcare Foundation NGO     10:07     Java, Java Interview Questions     No comments   

Do you know that we can pass a variable length argument lists in the method.This can be done by passing the datatype followed by an ellipsis(...) and then variable name.The ellipsis indicates that method can receive variable length of arguments of specific type.We can also use method overloading on this method.The ellipsis passed in the method is taken as the array of specific type.So we can apply the array operations on this variable length parameter list.
For Example:

package examples;

public class VarArguments {

public static int sum(int ... numbers){
int res=0;
for(int number:numbers){
res=res+number;
}
return res;
}

public static void main(String[] args) {
int a=12;
int b=13;
int c=14;
int d=15;
System.out.println("a="+a+"\nb="+b+"\nc="+c+"\nd="+d);
System.out.println("Sum of a and b is "+sum(a,b));
System.out.println("Sum of a,b and c is "+sum(a,b,c));
System.out.println("Sum of a,b,c and d is "+sum(a,b,c,d));

}

}
Output:
a=12
b=13
c=14
d=15
Sum of a and b is 25
Sum of a,b and c is 39
Sum of a,b,c and d is 54

In the above example i have created a method which takes a variable number of arguments.Then i have applied a for loop to get the sum of elements.In main method i have supplied 2 arguments then 3 arguments and then 4 arguments to get the sum of those numbers.
So tgis is a great thing we can apply in our programs where we don't know how much arguments have to be passed in the method which makes our problem simple.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Monday, 9 March 2015

Array in Java

 Unknown     09:47     Java     No comments   

An array is a group of variables of same types containing some values.In Java Arrays are objects so they are considered reference types.The elements of array can be primitive or reference types.If we want to access any element in the array, then we use the position number of that element in the array.This position number in the array is called the index or subscript of the element.
Declaration of array:
datatype[] arrayReference;   //preferred way
or
datatype arrayReference[];

For ex:   int[] arrayOfInts;
is an array which is pointing to the elements of type integer.
Defining array:
arrayReference=new datatype[arraySize];

For ex: arrayOfInts=new int[10];

We can combine the above two steps in one step as
 int[] arrayOfInts=new int[10];

So in this way we can define an array.
If the size of array is 10 then its index would be 0-9 i.e. 0 to (size-1).
For ex int[] arr=new int[5];
then its elements would be arr[0],arr[1],arr[2],arr[3],arr[4] and the array reference will be pointing to the first element that is arr[0].
The index of array can be a expression but it can't be negative.
For ex arr[a+b]=23;

How to pass an array to method?
Suppose we have an array int[] arr=new int[10];
and method declaration getArrayMethod(int[] a);
then the method call        getArrayMethod(arr);
passes the reference of array arr to method getArrayMethod().
The argument to a method can be passed as an entire array or only a single element.When a argument to the method is entire array, then it receives a copy of reference and when argument to method is an individual array element of primitive type then the method receives the value of that element.
Pass by value and pass by reference:
There are two ways to pass the arguments to the method:
1)Pass by value
2)Pass by reference

When an argument is passed by value,a copy of argument's value is passed to the called method.So if we made any changes to that argument then that changes will only be valid inside that called function since method contains the copy of that argument.So that updated value will not affect the original value of that argument outside that method.
If argument is passed by reference then called method can access the argument's value in caller directly and can modify its value.Pass by reference is used to improves the performance because in this case we don't have any need to copy the data,we only have to copy the reference of that data.
In Java,we cannot choose to pass by value or pass by reference, all arguments are passed by value.If argument is primitive type then copy of that primitive value is passed and if argument is reference type then copy of that reference is passed.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Data Hierarchy in Operating Systems

 Unknown     09:44     Java     No comments   

Data an important concept everywhere.Nothing exist without data.If we need to compute anything we need data.If we need to determine any result,we need data.So data is base for all the computing and we this world of computing can't exist without data.
What is data in terms of computers, at the lowest level data is stored in the computers in the form of bits which can be either 0 or 1.So anything which is stored in computers is in the form of bits.For ex 0111000111000 is a data which is stored in computers.
So we can explaining the hierarchy of data in computers:
1)Bits:It is the smallest data item in the computers.

2)Characters:It is very tedious to work with bits for a human,since we cannot remember all data in the form of 0 or 1.Instead of this we are able to remember patterns in the form of characters.So the decimal digits(0-9),letters(a-z and A-Z) and special symbols (@,#,$,%,^,&,*,? etc) are known as characters.Java uses Unicode characters that are composed of 1,2 or 4 bytes.THese Unicode characters contains characters from many languages of world.

3)Fields:Just as characters are composed of bits,fields are composed of characters or bytes.So a field can contain a sequence of characters or bytes that can convey some meaning.For ex "Abhishek" is a field which is representing a name,"23" is a field which can be the age of anyone or a number.

4)Records
:Records can contain several fields i.e. when we group some records then it can compose a record.For Ex suppose we have some fields such as name,age,address etc and if wegroup together all these fields then it can be called a record.
So i have a question, can you identify record in Java?
Yes you are right,Classes in Java can be called as records.In above example record can be called as Person which is having fields such as name,age, address etc.

5)Files:
Some records can be combined to form a file.But more generally a file can contain arbitrary formats such as in some operating systems,a file is viewed as a sequence of bytes.So we can say files as organization of data into records is a specific view whic is created by application programmer.

6)Database:
In early days data was organized in the form of files, but as soon as the size of the files increases,we felt a need for something which can organize those files.So there is database.A database is a collection of data organized for easy access to data and for its manipulation.Now a days most popular database is relational database in which data is stored in form of tables.

7)Big Data:Now a days the amount of data produced is very huge and it is growing quickly.So to deal this enormous size of data,we have Big Data applications which deals with this huge amount of data.This data hierarchy is new and it is evolving at a great rate.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Thursday, 5 March 2015

Synchronization in Java

 Unknown     07:14     Concurrency, Java, Thread     No comments   

What is thread synchronization?
Suppose we have a multi-threaded application i.e. our application have more than one thread.Since we know multiple threads can share an object.Suppose we have an object which is shared by multiple threads because of this unexpected results can occur unless access to shared object is managed properly.For example:We have two threads which are going to update that shared object what will happen if one thread is updating that object and another thread is in process of updating that thread and another thread is going to read that data.Then what will happen,Which data the third thread will read?
Old data or first thread's data or second thread's data.
What will happen if third thread was supposed to read that old data but has read the new data either of first or second thread.So data is not correct.
The above problem can be solved by giving only one thread access to shared thread on time exclusive basis and at the same time if another thread wants to access that shared object then it has to wait until the thread with that exclusive lock has finished its operation.So this  operation is called as Thread Synchronization.By synchronizing threads in this manner ensures that only one thread is using that shared object and other threads are waiting to access that object.This is called as Mutual Exclusion.
We need to synchronize only mutable data, there is no need to synchronize the immutable data.

How to perform synchronization?
Now we know basics of synchronization.Our next question is how to perform this synchronization in Java.
In Java,There is a concept of monitor.Each object has a monitor and a monitor lock(also known as intrinsic lock). This monitor is used to perform synchronization.Monitor ensures that the monitor lock is held by at most one thread at a time and this ensures mutual exclusion.If a thread want to access a shared object then it has to acquire the lock so that thread will be allowed to access that objects data.Other threads attempting to perform the operation which requires the same lock will be blocked until the first thread releases the lock and after that other thread can acquire the lock to perform operation.
The code which will be executed by the threads will be put in the synchronized block.The code inside the synchronized block is said to be guarded by the monitor lock.So thread has to acquire the lock in order to use that guarded block.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Wednesday, 4 March 2015

Typecasting in Java

 Earthcare Foundation NGO     07:31     Java     No comments   

What is type casting and why do we need it?
Suppose we have a variable of type float and we are assigning it a value of type int then there is no problem since it will automatically converted to float but suppose we have a variable of type int and we are assigning it a value of type double then what will happen? Compiler will throw an error (Type mismatch: cannot convert from double to int) since it cannot convert the double to int implicitly,we have to do it explicitly by casting that double value to int value.
for example:   int i=10.0 //error
int i =(int) 10.0;//no error since casted to int implicitly
So in this case we need type casting.Type casting is needed where we can have the data loss.Since if we want to convert value double to int then there will be data loss, all the digits after dot(.) will be lost.
For example:
1) int i=10;
valid since we are assigning int value to int type of variable.
Output: i=10

2) float f=10;
valid since automatic conversion will be done with no data loss.
Output: f=10.0

3)float f=12.0;
error since we cannot assign double to a float.Here you can think why it is double, so i can tel you if you write any number with dot(.) then it will be by default double.We can convert it into float in two ways:
typecasting or apply f

 float f= (float) 12.0;

or float f=12.0f;

4)int i=12.0;

error since cannot assign double value to int variable.
int i=(int) 12;
no error

So in this way we can use typecasting in Java.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Tuesday, 3 March 2015

Concurrency in Java

 Earthcare Foundation NGO     09:21     Concurrency, Java, Thread     No comments   

Every computer user want to do works in a fast way and they also want to do multiple works at a time. Suppose a user is working on MS Paint and now he can't open anything else. Means when he will finish the paint related work after that he can open other applications.Then it will be very bad for user.So to overcome these types of situations concurrency has introduced.So that user can run multiple applications at a time and the processing of the application increases.Even concurrency can be applied at the process level so that appication can concurrently execute more than one task at a time.
Concurrent programming difficulties:Concurrent programming is not so easy.Suppose you are reading one newspaper,one novel and one maths book and you are reading one book for some seconds say 15 and after that you are reading newspaper for 15 seconds and then you are reading novel for 15 seconds.What are the complexities in this procedure.There are a lot of things you have to do.First you have to switch between these readings and after that you have to remember the page numbers and then you also have to remember the line number so that you can continue.So above is a simple example by which you can understand that concurrent programming is not a simple task.
In concurrent programming there are two basic units of execution:
1)Process
2)Thread
A process has a self contained execution unit.Processes communicate to each other via IPC(Inter process communication).Each process has its own memory space.Most implementations of the Java virtual machine run as a single process. A Java application can create additional processes using a ProcessBuilder object.
A thread is also known as the lightweight process.Thread also provides a execution environment.Each process has atleast one thread.A thread can also create another thread.In java when you run the program a thread is created called main thread which can also create another thread.
We can define and start a thread in two ways:
1)Using runnable interface
2)inheriting Thread class
Click Here to know implementation of thread
Which of two ways is more beneficial.The first way which employe a runnable object is more general because it can subclass any class apart from Thread.The second method is easier to use in simple applications.So Runnable is used for high level applications and is more flexible approach.

Sleep():Thread.sleep causes the current thread to suspend execution for specified time.This method is provided so that other thread of the same process can use the  processor time or any other application can also make use of that time.There are two overloaded methods:
sleep(time in milisecond)
sleep(time in milisecond,time in nanosecond)
However these sleep times are not  guaranteed to be precise because they are facilitated by underlying OS.
Program Code:
package examples;

public class ThreadSleep {

public static void main(String[] args) throws InterruptedException {

for (int i=0;i<10;i++){
//sleep for two seconds
Thread.sleep(2000);
System.out.println(i);
}
}

}
Output:
0
1
2
3
4
5
6
7
8
9
Numbers from 0 to 9 has been printed at a interval of 2 seconds.In program main method throws an InterruptedException.This is an exception that sleep throws when another thread interrupts the current thread while sleep is active.

Interrupts:Interrupts are the indications to the threads to stop doing the thing which they are currrently doing and its upto the programmer how has he programmed the thread to do when an interrupt has generated. But in most scenarios threads are terminated.
 If thread is in any method and and it is interrupted then the best option is that thread should return from that method.We can explain it in example:
public class ThreadSleep {

public static void display() {

for (int i=0;i<10;i++){
//sleep for two seconds
try{
Thread.sleep(2000);
}catch(InterruptedException e){
return ;
}
System.out.println(i);
}
}

}
So in above method if exception comes then it should return from that method.
Now there can be a case,in above example we know that Thread.sleep() method will throw an exception an d then we can know there is interruption but suppose thread is using a method which does not use any other method which wil throw an exception.Then how will that thread will be interrupted.So for this we will use Thread.interrupted() which will return true if there is interrupt so that thread can be interupted.
For example:
public void disp(){
System.out.println("Hi this is abhishek awasthi");
if(Thread.interrupted())
return ;
}
join():Join method allows one thread to wait until other is complete.Suppose there are more than one thread and you want a proper sequence in which the thread should be executed then what can we do.Well we can use this join method.
Suppose there are three threads T1,T2,T3 and we want the sequence to be T1,T2,T3 then we can do one thing  we can call T1.join() and then we can call T2.join.So T1 will be completed first then T2 and then T3.In this way we can preserve the sequence of executing the threads.

So above is basics about concurrency in java.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Runnable in Java

 Earthcare Foundation NGO     09:00     Concurrency, Java, Thread     No comments   

First question is,What is runnable?
So runnable is an interface which is used to provide concurrency to the application by providing the threads to the application.It is the general way of creating threads.

Why should we use runnable interface over Thread class?
If we use Thread class then we have to create our own threads.We will have to manage it on our own.Means a lot of burden will be on the application.
Lets know the execution of runnable interface.So runnable object can be executed by Executor object.So what is this Executor?
An Executor object is used to execute runnable objects.It does this by creating and managing a group of threads in a thread pool.When a Executor begins executing a Runnable,the executor calls the Runnable's run method which is executed in the new thread.
So the next question is how does this Executor manages the threads?
Executor interface has a single method named as execute() which accepts the Runnable as argument.When execute method is called it selects a thread and assigns this thread to the passed Runnable object.If there is no thread available in thread pool then Executor creates the new thread and assigns it to the Runnable object.So this is the main advantage of using Runnable over Thread class.Since Executor can reuse the threads to eliminate the overhead of creating the thread whenever possible.This will optimize the performance of application.
Executor Service can be started by following statement:
ExecutorService service = Executors.newCachedThreadPool();


Program Code:
package examples;

public class ThreadEx  implements Runnable{

String name;
int time;
public ThreadEx(String name,int time){
this.name=name;
this.time=time;
}
@Override
public void run() {

System.out.println("Hi this is thread "+name);
try{
Thread.sleep(time);
}catch(InterruptedException e){
return ;
}
System.out.println("I am last executable line in thread "+name);

}

}

package examples;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadDemo {

public static void main(String[] args) {

ThreadEx t1=new ThreadEx("t1",2000);
ThreadEx t2=new ThreadEx("t2",1000);
ThreadEx t3=new ThreadEx("t3",1500);

System.out.println("Starting Executor");

ExecutorService service=Executors.newCachedThreadPool();
service.execute(t1);
service.execute(t2);
service.execute(t3);

service.shutdown();
System.out.println("Executor Shutdown");
}

}

Output1:
Starting Executor
Hi this is thread t1
Executor Shutdown
Hi this is thread t2
Hi this is thread t3
I am last executable line in thread t2
I am last executable line in thread t3
I am last executable line in thread t1

Output2:
Starting Executor
Executor Shutdown
Hi this is thread t2
Hi this is thread t1
Hi this is thread t3
I am last executable line in thread t2
I am last executable line in thread t3
I am last executable line in thread t1
In output2 main thread terminates before any of the ThreadEx objects outputs their statements and in output1 t1 object has output its statement before main thread terminated.This illustrates the face that we can't predict the order in which the tasks will be executed.It doesn't dependes upon the order in which they have created and started.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Monday, 2 March 2015

HashMap in Java

 Earthcare Foundation NGO     08:17     Collection, Java, Java Interview Questions     No comments   

How HashMap works in Java?
It is a simple answer,it works on the principle of hashing.In HashMap elements are stored in pair of (key,value) and also we can fetch the value in constant time O(1) provided we know the key.We store objects in HashMap using put(key,value) and retrieve value using get(key) which returns value.
Working of put(key,value):When we want to add a element in the HashMap,we provide the key value pair.Hashmap calculates the hashcode for the given key and after that it uses the hashing function to get the location in bucket array and then at that location it stores the key,value pair.Yes you are reading right.Key and Value both are stored in the bucket.But suppose more than one key is having the same hashcode then what will happen.Since if hashcode is same then the location will be same.For this we can use collision resolution techniques.HashMap stores elements in the form of linked list.So if there is collision,an extra node is added and that key value pair will be stored at that address.So in  this way we can overcome with this problem.Now you can ask next question how will we fetch the exact data if the location contains more than one key,value pair.So in this case,Since we know bucket stores key and value both and when we call get(key) then the value will be searched and if the location contains more than one key,value pair then key will be compared with equals() method and then the right value will be extracted.So in this way HashMap insertion and extraction work.


What happens if the size of hashmap exceeds the threshold defined by load factor?
When this happens it will act to resize the hashmap by creating a new bucket array of twice the size of previous hashmap. After that it will it will start putting every old element from old array bucket to new array bucket.This process is alled rehashing because when it copies the data to new array bucket first it applies the hash function to get new bucket location.
There can arise a problem.Suppose two threads at the same time sees that the hashmap bucket is full and has to be resized then both these thread will be resizing the bucket array and will produce a race condition.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Reverse of a given number using Java

 Earthcare Foundation NGO     08:14     Java     No comments   

In this post i will explain how to calculate reverse of the given number.Suppose given number is 234.Then what will be the reverse of this given number?
Answer is 432.

It is easy to find out the reverse of any given number using pen and paper, but if you want to calculate the reverse using a program then how will you write the program.
Lets think about it, if we want to reverse any number then what is our first task. Our first task is to get the last digit and put it at first, So for this what can we do?
If number is 234 then how will we get the last digit using expression.The answer is we can applu the % operator so that we will get the last digit of a number.
if number=234
int remainder=number%10
The above expression will give us last digit of a number that is 4
After this since we have extracted the last digit now we don't need it.So we have to find out the way to remove this last digit from number.How this can be done?
The answer is, if we will divide any number by 10 then we can remove last digit from number
so number=number/10
then number=23
So we have get the last digit in result and removed last digit from number.
Now we have a problem, when we find the reverse of a number then we do the following:
234= 400*30*2 = 432
But how will we add number of 0s in our program.I can suggest you a simple way, we can use a String variable in which only we have to concatenate the digits we are getting in remainder.
String res=res+remainder;
So after first step res=4    remainder=4 and number=23
now again performing those steps,
remainder=number%10 = 3
number=number/10=2
res=res+remainder=43
So in this way we can find out the remainder of any given number.Below is complete program:

Program Code:
package examples;

import java.util.Scanner;

public class Reverse {

private static String calcReverse(int number) {
String res="";
while(number>0){
int remainder=number%10;
   res=res+remainder;
number=number/10;
}

return res;
}

public static void main(String[] args) {
System.out.println("Enter the number to reverse \n");
Scanner in=new Scanner(System.in);
int number=in.nextInt();
String result=calcReverse(number);
System.out.println("Reverse of given number is "+result);

}
}
Output:
Enter the number to reverse
123567
Reverse of given number is 765321

So above is all about finding reverse of any given number.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Star Pattern printing in Java

 Earthcare Foundation NGO     08:04     Java, Java Interview Questions     No comments   

In this post i will explain about different patterns using java program.
1)Our first pattern is
 * 

 *  * 

 *  *  * 

 *  *  *  * 

 *  *  *  *  * 
So how can we print this pattern using Java program.First observe this pattern it has five rows and columns are increasing in each row and max columns are 5 which are equal to number of rows.so for first row we have to print star one time, for row two, two time and so on.
SO how can we do it?
So we have to do two things first we have to use a loop which will iterate for 5 times.
for(int i=1;i<=5;i++)
So above statement will iterate for 5 times next we have to print stars starting from 1 and for each iteration we have to increment it by 1 and the terminating condition is when it reaches value of row number i.e. for row 1 its 1
for row 2 its 2
for row 3 its 3 and so on.
So we can use  for(int j=0;j<i;j++)
So in this way the given pattern will be printed.Below is complete program:
package examples;

public class Pattern {

public static void main(String[] args) {

for(int i=1;i<=5;i++){
for(int j=0;j<i;j++){
System.out.print(" * ");
}
System.out.println("\n");
}

}

}

Output:
 *

 *  *

 *  *  *

 *  *  *  *

 *  *  *  *  *

2)Now we will print following pattern
                                             
                      *
                   * * *
                 * * * * *
              * * * * * * *
            * * * * * * * * *
              * * * * * * *
                 * * * * *
                   * * *
                      *


Program Code:
package examples;

public class Pattern1 {

public static void main(String[] args) {

int n=5;

//for iterating the rows
for (int i = 1; i <= n; i++)

         {
//for printing number of spaces before printing *
               for (int j = 0; j < (n - i); j++)

                     System.out.print(" ");
               //for printing * till half part i.e.
               //   *
             //  * *
           // * * *
        // * * * *
     // * * * * *
               for (int l = 1; l <= i; l++)

                     System.out.print("*");
               //for printing rest of the part
               for (int k = 1; k < i; k++)

                     System.out.print("*");

               System.out.println();

         }


//for printing lower part in same way as upper part is printed
         for (int i = n - 1; i >= 1; i--)

         {

               for (int j = 0; j < (n - i); j++)

                     System.out.print(" ");

               for (int l = 1; l <= i; l++)

                     System.out.print("*");

               for (int k = 1; k < i; k++)

                     System.out.print("*");

               System.out.println();

         }



         System.out.println();
}

}
Output:

                       *
                    * * *
                 * * * * *
              * * * * * * *
           * * * * * * * * *
              * * * * * * *
                 * * * * *
                    * * *
                       *



So above are  some patterns which can be printed using Java program.
Note:The 2nd pattern is not formatting well after coming on this page.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Difference between fail-fast and fail-safe iterators

 Earthcare Foundation NGO     07:57     Collection, Java, Java Interview Questions     No comments   

What is the difference between fail-fast and fail-safe iteartors in java?
fail-safe iterator is relatively new concept in comparison to the fail-fast iterator concept.


1)fail-fast iterator:fail-fast iterators fail as soon as they realize that structure of the collection has been modified since iteration has begin.Here structural changes means either some element has been added,deleted or updated.fail-fast iterators are implemented by keeping the modification count.So if there is some modification in collection after iteration started,it will throw a ConcurrentModificationException.Iterators returned by Vector, ArrayList, HashSet , HashMap etc are fail-fast.


2)fail-safe Iterators:fail-safe iterators don't throw any error when there is any modification during iteration.This is because iteration is done on the clone of collection instead of original collection.So thats why they are known as fail-safe because they will not throw ConcurrentModificationException whenever there is modification in collections. Iterators returned by CopyOnWriteArrayList is an example of fail-safe iterator.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Sunday, 1 March 2015

Factorial of a number in Java

 Earthcare Foundation NGO     10:27     Java     No comments   

In this post i will explain how to write a program to get the factorial of a given number.I have written two programs.First one uses for loop to find the factorial and second one uses recursion.But before that i will explain how to find the factorial.
Suppose number is 4.Then to find out factorial of any given number we will multiply it with (number-1) until number becomes 1.Since the factorial of 1 is 1 So we end the procedure there.
factorial(4)=4*3*2*1
                =24
factorial(5)=5*4*3*2*1
                 =120
So in this way we can find out the factorial of any given number.

So in the following program, I am taking the input from user in main method and then called the getFactorial() function which takes the number as argument.In method getFactorial(), I have taken a local variable res  which will hold the result.Then i started a for loop in i am multiplying the number with res and after each iteration the value of i is decremented by 1.


Program Code:
package Progs;

import java.util.Scanner;

public class Factorial {

    private static int getFactorial(int number){
        int res=1;
        for(int i=number;i>=1;i--){
            res=res*i;
        }
        return res;
    }
    public static void main(String[] args) {
       
        System.out.println("Enter the number to calculate its factorial");
        Scanner sc=new Scanner(System.in);
        int number=sc.nextInt();
        int result=getFactorial(number);
        System.out.println("Factorial of given number is "+result);
    }

}

Output:
Enter the number to calculate its factorial
4
Factorial of given number is 24
Suppose number=4
for 1st iteration,
i=4       res=1
res=1* 4
     =4

for 2nd iteration,
i=3     res=4
res= 4*3
     =12

for 3rd iteration,
i=2       res=12
res=12*2
     =24

for 4th iteration,
i=1       res=4
res=24*1
     =24

for 5th iteration,
i=0   res=24
it will exit from for loop 

The following program is a recursion based program.
Program Code:
package Progs;

import java.util.Scanner;

public class Factorial_Rcursion {

    private static int getFactorial(int number) {
        int res=number;
        if(number==0)
            return 1;
        res=res*getFactorial(number-1);
        return res;
    }
    public static void main(String[] args) {
        System.out.println("Enter the number to calculate its factorial");
        Scanner sc=new Scanner(System.in);
        int number=sc.nextInt();
        int result=getFactorial(number);
        System.out.println("Factorial of given number is "+result);

    }   

}

Output:
Enter the number to calculate its factorial
5
Factorial of given number is 120


 In getFactorial()  method again i have taken a local variable which will hold the result.Then i have checked for exit condition i.e.if number==1 and after that i have written a expression which will calculate the factorial of number recursively
res=res*getFactorial(number-1);

Suppose number=4
Then
res=4*getFactorial(3)
then method will be called again until getFactorial(1) where first condition will be satisfied it will be returned to its previous call and factorial will be calculated.
res=4*3*2*getFactorial(1)
      =4*3*2*1
      =24

So in this way we can calculate the Factorial of any given number.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Null in Java

 Earthcare Foundation NGO     06:42     Java, Java Interview Questions     No comments   


null is a very important concept in java.
1) null is not a keyword in java,it is actually a literal just like true and false.
Click here to get a better idea.
2) null is default value for any reference variable in java

static Object obj;
public static void main(String ar[]){
System.out.println("Value of Object is "+obj);
}

Output: Value of Object is null


3) null cannot be assigned to any primitive datatype

int i=null  //type mismatch : cannot convert from null to int
float i=null  //type mismatch : cannot convert from null to float

4) null can be assigned to any wrapper class

Integer i=null  //no error
int j=i //This is ok at compile time but at run time it will throw a NullPointerException.

Above is because at run time Java unbox Integer to int and supply its value to variable j then it will throw a  NullPointerException.

5) We cannot call a non static method on reference variable with value zero since it will throw a NullPointerException. But we can call a static variable on reference variable with value 0.


public class MyClass{
public static void  staticMethod(){
    System.out.println("I am in static method");
}

public void  nonStaticMethod(){
    System.out.println("I am in non static method");
}

public static void main(String ar[]){
MyClass obj=null;
obj.staticMethod();
obj.nonStaticMethod();
}
}
Output:
I am in static method
Exception in thread "main" java.lang.NullPointerException  at MyClass.main(MyClass.java:13)

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Final in Java

 Earthcare Foundation NGO     06:35     Java, Java Interview Questions     No comments   

Final is very important keyword in java which can be applied to variable, method or class in java.Once you make a reference final then you are not allowed to change that reference and on doing so compiler will show the error.

Final variables:We can make the variables final in java and after declaring varibale final we cannot modify it later. Java will treat it like a constant variable. Normally we use static with final and we take variable in capital letters to differentiate it from normal variables. Variables in interfaces are always final.So final variables are read only.
for Ex:

public static final NAME="Abhishek";
NAME="Abhi"; //compiler error

Final methods: We can also make our methods final in java. If we declare our method final then we cannot override it. We can make those methods final which we think are complete and will not changed in future. Final methods are faster than non-final methods because they are not required to be resolved during run-time,they are bonded at compile time.
for ex
  public class MyClass{
public final int getAge(){
return 18;
}
}

public class MyClassOther{
public int getAge(){
return 21;   //compilation error
}
}

Final class: We can also make our class final in java.If we will make our class final in java then the class cannot be inherited.

For ex

 final class MyClass{
//Statements
}

final MyClassOther extends MyClass{  //compilation error
//Statements
}

Advantages:
1) Final keyword improves performance because JVM as well as application can cache the final variables.
2) Final variables can be shared in multi-threading environment without additional synchronization overhead.
3)Final classes, methods and variables can be optimized by JVM which will improve the performance of the application.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Immutable Objects in Java

 Earthcare Foundation NGO     06:30     Java, Java Interview Questions     No comments   


Immutable classes are those classes that cannot be modified after creation. If we want to modify immutable class then it will result in new immutable object.Immutable objects are very important in concurrency and they makes the programs efficient.
First we will see how to create an immutable object.As we know there are following step by which any object can be made as immutable:

1) Don't provide mutator methods for any field.
2) Make all the fields final and private
3) Don't allow subclasses by declaring the class final
4) Return deep cloned objects with copied content for all mutable fields in class
So we will apply these steps to create a immutable object.

public final class ImmutableClass{
private final String name;
private final String designation;
public ImmutableClass(String name,String designation){
this.name=name;
this.designation=designation;
}
public String getName(){
return name;
}
public String getDesignation(){
return designation;
}
}

So above is an example of an immutable class.
But there can be a case when we have to include an mutable class(such as Date) within an immutable class, Then what can we do? We will make it as final member but it can be modified internally. So in this case the best practise is to return the copy of that object instead of original object. FOr this we can clone that object and return it.
For Example

public final ImmutableClassWithMutableObject{
private final Date date;
public ImmutableClassWithMutableObject(Date date){
this.date=new Date(date.getTime());
}
public Date getDate(){
return (Date)date.clone();
}
}
So above is a program of immutable class when it contains a mutable class.

Advantages of immutable class:
1)They are thread safe so no need for synchronization
2)Immutable objects can be shared among threads without synchronization
3)Due to no synchronization performance of the application increases
4)They can be stored in cache and reused as Immutable objects Strings.

Disadvantage:
There is a huge disadvantage of creating garbage.Since immutable objects are use and throw so they create a huge garbage which reduces the performance of the application.

So above is all about immutable object.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Thread concept in java

 Earthcare Foundation NGO     06:25     Concurrency, Java, Thread     No comments   

A thread is known as a lightweight process. A thread is a basic processing unit to which an operating system can allocate processor time.It is better to use threads, but it doesn't mean that we can create as many as threads and our process will become more efficient. But as we know that threads also consume resources so we should create threads according to the need of application.
Every java program has at least one thread and that thread executes the java program.It is created when the main method of java program is invoked.A java program can have also more than one threads. For example a swing application has at least two threads.

Thread creation:Thread can be created in two ways:
1. Extend the java.lang.Thread class.
2. Implement the java.lang.Runnable interface.

In second method we have to override the run method. Now when the thread is started by calling the start() method run() method will automatically called.Once the run() method returns or throws an exception, the thread dies and will be garbage-collected.
A thread can be in following states during its lifetime:
new,runnable,blocked,waiting,terminated,timed_waiting
The values that represent these states are encapsulated in the java.lang.Thread.State enum. The members of this enum are
NEW, RUNNABLE, BLOCKED, WAITING,TERMINATED and TIMED_WAITING.

package threads;

public class ExtendThread extends Thread {


public static void main(String[] args) {

ExtendThread thread = new ExtendThread();
thread.start();
System.out.println("Hi this is a thread example");

}
}
Above is an example of creating thread using method 1

package threads;

public class ImplementsRunnable implements Runnable {


public void run() {

for(int i=0;i<100;i++){
System.out.println(i);
try {
Thread.sleep(100);
} catch (InterruptedException e) {

e.printStackTrace();
}
}

}

public static void main(String[] args) {

ImplementsRunnable obj = new ImplementsRunnable();
Thread thread = new Thread(obj);
thread.start();

}
}

This is another method which is by implementing runnable method. In this example we have created a class which implements runnable interface,So we have to override run method of thread.In main method we have created an object of this class and passed this object in thread constructor so that a thread will be created for this class.In run method we are just printing numbers from 1 to 99 and we have also used a sleep method of thread which will sleep the thread for specified time.After we have started the thread by calling start() method, run() method of the thread will be automatically called
and executed.

Thread priority:When there are multiple threads in our application, we have to decide the scheduling of those threads. For this we can set the priorities to different threads. We can use the following method:
public final void setPriority(int priority)
Synchronization:Since we know that threads run independently but we may get a situation in which threads have to access the shared data. In this situation what will happen if two threads will access the same data and one thread is reading that data and other thread is modifying that data.
Now in this situation we can't guarantee for the correct data.So for these situations we have synchronization. The shared data can be synchronized so that if one thread is using that data no other thread can access that data until first thread has not completed the task. This synchronization is performed by using monitor lock. When a thread has a lock on some synchronized object and if another thread tries to access that thread then that thread will be blocked till the first thread finish the task using that synchronized object.

Method Synchronization:We can synchronize any method by writing synchronized keyword in method header.


    public synchronized int addition(int a, int b) {

        return a+b;

    }


Block synchronization:Block synchronization can be used to synchronize a block. Suppose an object has to be shared among threads and it is not synchronized and also we don't have access to its code then what will happen? What can we do?We can synchronize it by using block synchronization.
Suppose object1 needs to be synchronized then we can synchronize it by using this
synchronized(object1){
//call the methods of that object
}

So above is all about threads.Kindly comment if you want to know more.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Ad


Jobsmag.inIndian Education BlogThingsGuide

Subscribe

Do you want fresh and hot updates about us? Then subscribe to our Feeds.

Total Pageviews

Popular Posts

  • Write a program in PL/SQL to print the factorial of a number.
    In this post I will explain how to get the factorial of any given number. For that first you need to know what is the procedure to find ...
  • To find the GCD of two numbers in PROLOG.
    gcd(X,Y):-X=Y,write('GCD of two numbers is '),write(X); X=0,write('GCD of two numbers is '),write(Y); Y=0,write('G...
  • Write a PL/SQL code to get the Fibonacci Sequence
    First, I will explain what is Fibonacci Sequence and how to get this series. So, Fibonacci Sequence is a series of numbers 0,1,1,2,3,5,8,1...

Label

All Articles Best Resources Blogging Boost Traffic Bootstrap C Plus Plus Collection Comedy Comedy Posts Comedy Videos Concurrency creative commons website Education Employee Entertainment Fibonacci Sequence free images GirlFriend Hinglish Cafe How To Image Websites Inspirational Java Java Interview Questions Java Networking Kavita Sangrah Life Lock Sreen Love Number System Patterns Perl Picture PL/SQL Plastic Engineering Programming Prolog public domain SEO Servlet Short Story Shortcut Keys Social Media Social Services SQL SuVichar Thread Traffic True Events Ultimate Guide Windows Tricks Windows8.1 WordPress

Blog Archive

  • ►  2020 (43)
    • ►  September (41)
    • ►  August (2)
  • ►  2019 (1)
    • ►  July (1)
  • ►  2018 (9)
    • ►  September (7)
    • ►  July (1)
    • ►  May (1)
  • ►  2017 (8)
    • ►  June (3)
    • ►  May (3)
    • ►  March (1)
    • ►  January (1)
  • ►  2016 (2)
    • ►  September (1)
    • ►  January (1)
  • ▼  2015 (91)
    • ►  December (1)
    • ►  November (1)
    • ►  October (6)
    • ►  May (10)
    • ▼  March (20)
      • ArrayList Methods in Java
      • ArrayList Methods in Java
      • ArrayList in Java
      • Arrays Class in Java
      • Java Interview Question-Variable length arguments ...
      • Array in Java
      • Data Hierarchy in Operating Systems
      • Synchronization in Java
      • Typecasting in Java
      • Concurrency in Java
      • Runnable in Java
      • HashMap in Java
      • Reverse of a given number using Java
      • Star Pattern printing in Java
      • Difference between fail-fast and fail-safe iterators
      • Factorial of a number in Java
      • Null in Java
      • Final in Java
      • Immutable Objects in Java
      • Thread concept in java
    • ►  February (50)
    • ►  January (3)
  • ►  2014 (339)
    • ►  December (1)
    • ►  October (55)
    • ►  September (58)
    • ►  August (94)
    • ►  July (64)
    • ►  June (67)
  • ►  2013 (34)
    • ►  August (5)
    • ►  April (29)
  • ►  2012 (20)
    • ►  November (1)
    • ►  October (15)
    • ►  September (4)

Author

  • Earthcare Foundation NGO
  • Kavita house
  • Unknown
  • Unknown

Info

Copyright © Hub Of Geekz | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates