Thursday, 3 November 2011

Arrays in Java| Core Java tutorials

Arrays in Java:
An array is a group of similar data type items that share common name.
Arrays occupy contiguous memory locations.
Array size is fixed and cannot be altered dynamically.
 A particular value is indicated by writing a number called index number or subscript in square brackets after the array name.
For example we can define an array name employee to represent a set of salaries of  a group of employees. For example
Employee [3]
Represents the fourth employee starting from zero.
Complete set of values is referred to as array, the individual values are called elements.
Arrays can be of any primitive datatypes. It is also possible to create array of objects.
One dimensional arrays:
A list of items can be given one variable name using only one subscript and such a group of variables is called one dimensional array.
Ex:int count[];
double  [] average;
Multidimensional array
It is actually an array of arrays. To declare a multidimensional array variable, each additional index should be specified using another set of square brackets.
Int marks [][];
Declaration of Arrays:
Ex:int count[];
double  [] average;
Creating one dimensional array:
Arrays must be declared and created in the computer memory before they are used. Creation of Array involves
a)      Declare the array.
b)      Create memory location
c)       Assigning the values in memory location

Declaration of Arrays:

Arrays in java may be declared in two forms:
 a)      datatype array- name[];
b)      datatype [] arrayname;

Wednesday, 2 November 2011

Super method in Java| Java tutorials

super() method is used to call superclass constructor from subclass constructor. Depending on the parameters we pass, appropriate super() method is called.

Restrictions of using super():

a)If exists, it must be the first statement in the constructor.

b)We cannot use two super() methods within the same constructor as both cannot be the first. We cannot use two super() statements or two this() statements or one super() or one this() within the same constructor.




Super keyword in Java| Java tutorials


Super keyword in Java
Super keyword is mainly used to access superclass variables and methods in subclass.

The variables and method s of a superclass can be overridden by the subclass. In case of overriding , a subclass object calls its own variables or methods. That is,subclass cannot access superclass methods as long as they are overridden. Other way, the overridden variable or method blocks that of super class.

Java still provides a way to access the superclass members,even if they are overridden. It is possible by using super keyword.

Note:The restriction of using super keyword is that we should not use it from a static method.

Method overriding in Java


Method overriding in java

Overriding is a concept where instead of inheriting a method from its superclass,  a subclass can override the method by providing its own functionality to it. That is, subclass and superclass have the same method but outputs are different.  Overriding is useful on occasions when we want an object to respond to the same method but have different behavior when that method is called.  

The overridden method in the subclass has the same name, same arguments and same return type as the method in super class. Then, when that method is called, the method defined in subclass is invoked and executed instead of the one in the superclass.

If the superclass and the subclass have the same method, we say the superclass method is overridden by subclass. It is called method overriding. In case  of method overriding, the subclass prefers to call its own method.

Tuesday, 1 November 2011

Difference between c++ and Java?


                             Java
                            C++
1)There are no pointers in java
1)There are pointers
2)There is no  operator overloading in Java
2)There is operator overloading in C++
3)There are no  processor directives
3)There are preprocessor directives
4)There are no Structures and Unions
4)There are Structures and Unions
5)There is no go to statement
5)There is go to statement in C++
6)There are no global variables
6)There are global variables
7)There are no templates
7)There are templates
8)There is garbage collection
8)There is no garbage collection
9)Java does not support multiple inheritance
9)C++ supports multiple inheritance



Saturday, 22 October 2011

Collection Interfaces tutorial and collection Interface video free download

Collection Interfaces video tutorial




It is the root of collection hierarchy. A Collection includes a group of objects known as elements. Some Collection classes allows duplicate elements, and others do not. Some are ordered and others are unordered. All collection class implement Collection interfaces or subinterfaces.

Signature:
public interface Collection<E> extends Iterable<E>

Collection Interface extends Iterable interface

int size():Returns the number of elements in collection.

boolean isempty():Returns true only if collection is empty.

boolean Contains(Object o):Returns only if specified element is in the collection.

boolean add(Element e):This is used to add a single element to collection.This method true only when the element is added.

boolean remove(Object o):This element will remove specified element from collection. Returns true if the element is removed from collection.






Hash map tutorial and Hash map video free download

 Video sample screenshot:

 













Hash Map is like Hashtable which stores key/ value pairs. It implements Map interface and we can use all operations of Map interface. It permits null values and null key. The Hash Map class is almost equivalent to Hashtable, except that its unsynchronized and permits nulls. The order of elements is not guaranteed.

Following is the signature of HashMap class:
Public class HashMap extends AbstractMap implements Map, Cloneable, Serializable

HashMap constructor can be specified with -initial capacity and load factor. The capacity of HashMap gives the storage capacity and size() gives the actual elements present in the HashMap. The intial capacity gives the starting capacity of Hash Map when it is created. The load factor gives at what rate the capacity must be increased when the existing capacity gets exhausted. The default load factor is 0.75

There are four constructors in the class HashMap.

HashMap():
It creates an empty HashMap object with an initial capacity of 10 and default load capacity of 16.

HashMap(int cap):It creates an empty Hash Map object with an intial capacity specified as "cap" and a default load capacity of 16.

HashMap(int cap, float loadfactor): It creates an empty HashMap object with intial capacity specified as "cap" and a load capacity specified as "loadcap".

HashMap(Map m1):It creates a HashMap object with the elements of another Map class specified as "M!"




Array list and arraylist video free download














Click here to download video on arraylist

Click here to download video on arrayList display

 Array List is a subclass of AbstractList and implements List. Following is the signature of ArrayList:

public class ArrayList extends AbstractList implements List, Cloneable, Seriablizable

ArrayList includes a feature called dynamic arrays that can increase dynamically as and when needed. In other words, ArrayList is a dynamic array that stores objects. ArrayList size automatically increases when we add elements and shrinks when we remove elements.


Tuesday, 18 October 2011

Bug life cycle video free download
















 

Bug life cycle:
The different states of bug are summarized as follows:
1)      New: When the bug is posted for first time it will be in new  state .In this state bug is not approved state.

2)      Open: When the bug is posted for first time lead will check whether the bug is genuine or not, if it is genuine he will approve the bug and change the state as open. 

3)      Assign: Once the lead assigns the state as open he will assign the bug to the corresponding team. The state of the bug is now assign.

4)      Test: Once the developer fixes the bug, he need to assign to testing team for next  round of testing. Before releasing the software with bug fix he will assign the state as Test.

5)      Deferred: The bug is in deferred state means it is to fixed in next  releases. The reason for changing the defect to deferred state has many factors. Some of them are priority may be low,  lack of the time for release or the bug may not have major effect on the software. 

6)      Rejected :If the developer feels the bug is not genuine he rejects the bug, then the state of bug is  rejected. 

7)      Verified: If the bug is not present in the software he approves that bug is approved and changes the state to verified.

8)      Reopened: If the bug is fixed by developer and the tester still finds the bug he will change the status to reopened. Once the bug is reopened it  passes the lifecycle once again.

9)      Closed: once the bug is fixed by developer, if it s  no longer exists in the software he changes the status to closed. This state means bug is fixed, tested and approved that bug does’nt exists no more.

Monday, 17 October 2011

Type casting in java video free download












Type Casting:
We can assign primitive datatypes one to another. This is called casting. The process of casting is governed by some rules.

Rules of Casting:
1. The data types must be compatible. That is a boolean value is incompatible and cannot be assigned to any other type.

2. A datatype of lower size can be assigned to data type of higher size and is done implicitly.

3.A data type of higher size cannot be assigned to data type lower size implicitly and is done explicitly.

Implicit Casting:

When we assign variable of data type of  lesser memory size to variables of higher memory size, the system does casting implicitly. For example:
int x=100;
double d=x;

In the above case casting is done implicitly by the system as we are assigning x of data type int to d of data type double. This is called 'widening conversion' and is done implicitly.

Explicit casting:
  When we assign variables of data type of higher memory size to variables of lesser memory size, system does not perform implicit casting. We have to do ourselves the casting. This is called explicit casting. In explicit casting data will be truncated or precison of the value is lost. For example:

double d=10.5;

//int x=d;                       //raises compilation error

int x=(int) d;

In the above example, casting is done explicitly by us as we are assigning d of data type double to x of data type int. This is called narrowing conversion.

Garbage collection in java , Garbage collection video free download











Click here for Garbage Collection video free download

Garbage Collection and its uses:

The objects that are not used and not referenced further in the program are treated as garbage and can be removed so that the memory is best utilized. That is , memory can be recycled and thus memory leaks does not occur.

It is difficult to know when the memory will be freed of an object in a process. Garbage collection relieves the programmer from the burden of freeing the allocated memory. Java does this job implicitly. 

We can advice the JVM to do garbage collection using gc() method of System class as follows:
System.gc();

Garbage collector is a low priority thread and is executed periodically whenever the processor is free. The garbage collector is a two phase process Mark and Sweep. Mark is the first phase, it marks the objects that are not used or referenced in the program.(known as garbage). In the next process sweep the unused objects are destroyed and the memory is freed.

One of the important features of Java is implicit memory management where memory is automatically created or destructed. For memory destruction, Java includes a concept called garbage collection. Even though every thing is implicit where programmer productivity increases , sometimes it is necessary to know the particulars of heap memory variable available, used and remaining;it may be necessary when we want to know the program size and availability of the memory.

Saturday, 15 October 2011

What is an object in java?



An object is an instance of a class. An object is known by a name and every object contains a state. The state is determined by the values of attributes(variables). The state of an object can be changed by calling methods on it.

The sequence of state changes represents the behaviour of the object.

An object is a software entity that combines a set of data with set of operations to manipulate the data. A class defines the type of object. That is, each object belongs to some class and object is also called an instance.

Click here to download  objects video in java


What is a class in java?

A class is a blueprint for objects. The class defines variables, methods and objects. The object manipultates data through methods.

Classes are fundamental units in object oriented programming. We use class to create objects. Each instance carries its own data. If data belonging to one object ,if changed it does not affect the data belonging to the other object. 

what is an interface in java?



An interface is a class containing a group of constants and method declarations that do not provide implementation. Interface contains all abstract methods. Interface allows what a class must but do not specify how to do.

One class can implement any number of interfaces. We must use implements keyword instead of extends. This is the way of multiple inheritance, which java supports.

An interface can have instance variables also that can be used by its subclasses. All the instance variables must be declared as public, final and static. If public, static and final are omitted, they are assumed by default.

The public interface of a class is a contract between the client code and and the class that provides the service. Concrete classes implement each method. Java interface declares only the contract and no implementation. 

Interface should only contains abstract methods.

The access specifier must be  public.

The variables are public, static and final.

Multiple inheritance is possible.

Inheritance uses key word implements.

Interfaces must be public.






String and its methods video free download














Click here to download String and its methods video

In java String is an object that can be assigned with a group of characters enclosed in double quotes. String class cannot be subclassed as it is declared final in the java.lang package.

The class header of String class is

Public final class String extends Object implements java.lang.Serializable

Strings are immutable in nature. When a string is created, a memory allocation is assigned. When reassigned, the string is allocated a new memory location and old one is garbage collected. That is, for every assignment, a  new location is created.

Some important methods:
indexOf(char ch)
charAt(int index)
Substring(int num)
ValueOf()
length()
equals()




























Tuesday, 11 October 2011

Types of software testing video free download

Regression testing video free download
















Author:Softwaretestingvideos.com 

The  main objectives of regression testing are to check the new functionalities have been incorporated correctly in to the system with out failing the existing functionalities.Also validate whether the defect resolution works have injected any unexpected or unintended side effects.


Regression testing is mostly done by using automation.