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 / manish kushwaha

1) Default Specifier in Java: there are mainly 4 types of
Specifier in Java
a) public : can be use any where no restriction
b) Protected: can be use in same package and subclass of
different package
c) default : can be use in same package same class and sub
class (you no need to write any key word for that if you
are not writing any word before any method or variable
then compiler and JVM will assume this as default
specifier in java).
d) private : can be use within the class only


2) Default Constructor: Here again two type concept will
come
a) If you are not writing any any constructor then JVM
will assume a default constructor with this constructor
it will call super class constructor as.
class A{
// here if you are not writing any constructor then
JVM will assume default constructor like
A(){
super(); // here it is calling Object class Constructor
}
}

b) if you are writing any constructor then JVM will igore
to assume default constructor it will take your
constructor again here your specifier comes into
picture like
class A{
//you are writing constructor as
A(){
//This is your own constructor with default specifier
you can invoke this constructor within the package.
}
}


3) Default Method: There is no such default method in java
JVM can not Assume a default method.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is indexof?

910


Can a class be defined inside an interface?

977


Give me some null interfaces in java?

1002


Why does java not support operator overloading?

1077


What does the “final” keyword mean in front of a variable? A method? A class?

939


Is java good for beginners?

963


What is Hierarchy of exception?

1029


Explain the usage of this with constructors?

972


Name some classes present in java.util.regex package.

978


What happens when you add a double value to a string?

931


What is fundamental datatype?

938


What does microservices mean?

892


how to prepare for IT Officers Interview in Banks

1911


What happens to a static var that is defined within a method of a class?

978


Is there any way to skip finally block of exception even if some exception occurs in the exception block?

999