Monday, 29 October 2012

What will be the result of the following code Snippet

String a=null;
if (a!=null & a.length()>10) {
System.out.println("Success");
}
else {
System.out.println("Failure");
}

Ashish_Deovanshi: when and who is responsible for initialize the sta...

Ashish_Deovanshi: when and who is responsible for initialize the sta...: when and who is responsible for initialize the static variables in java ?

What is the difference between "abstract Class" and "interface" in java ? 

Main Difference between abstract class and interface are ....
Abstract Class is used for Base Class implementation for all the Class whereas interface is used for property of base Class.
Example : Animal, Bird, tiger, fish. All are Animal as abstract class & having properties eat same for all but fly, run and swim is different properties. so we can put eat as abstract method in abstract class and fly, run & swim used as interface.

The difference between abstract class & interface are as under
1) An abstract class can provide complete code whereas interface cannot provide any code at all
2) In abstract class, a class may extend only one abstract class whereas a class may implement several interfaces.
3) An abstract class can have non abstract methods. whereas all methods of an interface are abstract.
4) An abstract class can have instance variables. whereas interface cannot have instance variables
5) An abstract class can contain constructors. Whereas interface cannot contain constructors.
6) Abstract class are fast. Whereas interface are slow .

 

 

Wednesday, 24 October 2012

when and who is responsible for initialize the static variables in java ?


To know how to install and configure android sdk. please let me know your interest i will explain.