Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

wHAT IS DEFAULT SPECIFIER IN JAVA
wHAT IS DEFAULT CONSTRUCTOR IN JAVA
wHAT IS DEFAULT METHOD IN JAVA

Answer Posted / srinu

DEFAULT SPECIFIER IN JAVA:
There are 4 types of accessibility specifier in java, they
are private,public,protected and default.
There is no key word in java to specify default specifier
When we do not specify any specifier which means default
specifier,the default specifier access the with in package
only.
EX:- public void setName(String name)
{
this.name=name;
}
The above method access any class or any package
void setName(String name)
{
this.name=name;
}
The above method can access with in package.

DEFAULT CONSTRUCTOR IN JAVA:-
THE default constructor in java is System default constructor.

EX:-
public class A
{
String name;
public void setName(String name);
{
this.name=name;
}
}
The above program their is no constructor .then that time
java compiler created default constructor.

Note: we can interested see default constructor frist we
compile java program(javac A.java) after javap A.Then that
time u watch system default constructor.

DEFAULT METHOD IN JAVA:--
The dafault method in java is super().
EX:-
public class A
{
A()
{
System.out.println("IAM CONSTRUCTOR FROM CLASS A ");
}
}
public class B extends A
{
B()
{
System.out.println("IAM CONSTRUCTOR FROM CLASS B");
}
public static void main(String k[])
{
B b=new B();
}
}
output:-
IAM CONSTRUCTOR FROM CLASS A
IAM CONSTRUCTOR FROM CLASS B
hence super() method is default method

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is fastest collection in java?

996


how are methods defined?

995


What are the types of web technologies?

996


What do you understand by abstract classes?

1017


Write a java program to print fibonacci series?

908


What is meant by oops concept in java?

930


What is regex in java?

900


Can we declare array without size in java?

959


Is void a data type?

900


What is a copy constructor in java?

1048


What are the ways in which a thread can enter the waiting state?

882


Explain methods specific to list interface?

914


Which eclipse is best for java?

957


What is anagram word?

954


Tell me are there implementations for sorting and searching in the java libarary?

977