Sunday, August 26, 2012

ARRAYLIST in java


ArrayList implements all List operations using List interface and is also accept null values.The ArrayList is re sizable i.e shrinks and grows automatically and it has a capacity .

The class hierarchy is as follow:
---->Java.Lang.Object
      ----->Java.Util.AbstactCollection
                ----->Java.Util.AbstractList
                        ------>Java.Util.ArrayList

The array list contains following methods for implementing different operations



Return typeMethod name
voidadd (int index, Object o)
booleanadd (Object o)
booleanaddAll (Collection c)
booleanaddAll (int index,Collection c)
voidclear ( )
Objectclone ( )
booleancontains (Object o )
Objectget (int index)
intindexOf(Object o)
booleanisEmpty( )
int lastIndexOf( Object o)
Objectremove( int index)
Protected voidremoveRange( int fromIndex, int toIndex)
Objectset (int index, Object o)
intsize ( )
Object [ ]toArray( )
Object [ ] toArray (Object [ ] a)
voidtrimToSize( )




Wednesday, August 15, 2012

OPERATOR PRECEDENCE IN JAVA


Operators in Java are special symbols that executes specific operations on one, two, or three operand/operands, and then return a result.They moves to left to right or right to left.In the table bellow all the Java operators has been described with examples




Saturday, August 11, 2012

ACCESS MODIFIER IN JAVA



There are 4 access modifier in core Java. They are public, private, protected and default.
The table bellow shows the access of class with different modifier








Access Modifier table
     Visibility                                

PUBLIC  
    PROTECTED  DEFAULT PRIVATE
Access from the same class            YES                 YES YES YES
Acces from any class in same package YES YES YES NO
From subclass in same package YES YES YES NO
Access from subclass outside package YES YES through inheritance NO NO
Access from any non subclass outside package YES NO NO NO