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

Is array an object in java?

949


What is a super method?

975


Can we define a package statement after the import statement in java?

1061


What is difference between final and finally in java?

1072


In how many ways we can do exception handling in java?

990


Can we start a thread twice in java?

974


What is replaceall in java?

1011


What is the significance of java packages?

1102


What happens if we don’t override run method ?

998


What is the purpose of encapsulation?

1006


how can you catch multiple exceptions in java?

1007


What is the purpose of a transient variable?

1050


Difference between ‘is-a’ and ‘has-a’ relationship in java?

998


Explain the importance of finally block in java?

951


What is contract between hashcode and equal method?

1026