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 callablestatement? How you can call stored procedure to pass in parameter?

631


What is sizeof () operator?

645


Which collection is sorted in java?

652


What is meant by class loader? How many types are there?

780


Why string is a class?

624






How we can run a jar file through command prompt in java?

617


What is the benefit of lambda expressions?

586


Why is the type for real numbers called double?

634


How big is a 32 bit integer?

642


Explain about wait() method?

669


What are the 5 types of research methods?

698


What is primitive array?

591


Is java programming easy?

634


Which programming language is most secure?

632


What is the difference between a method and a procedure?

629