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

Answer Posted / debasankar

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,

For Example :
public String getName(){...}
// here accessibility specifier is public

String getName(){...}
// here accessibility specifier is defalut, whose scope
is package-scope means this method is not accessible outside
the current package

DEFAULT CONSTRUCTOR IN JAVA:
Default constructor is the implicit constructor provided by
the compiler when we do not specify any constructor in our class
Default constructor looks like..
---------------------------------
<Access Modifier> <class_name>(){
super();// implicit super call
}

I have not heard about any default method in java..As far my
knowledge there is no default method till JAVA platform 1.4....

Is This Answer Correct ?    20 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of arrays in java?

673


Which are the two subclasses under exception class?

619


Is there any difference between synchronized methods and synchronized statements?

669


How to instantiate static nested classes in java?

645


How to perform merge sort in java?

680






Is zero a positive integer?

639


Can a class with private constructor be extended?

588


Is oracle java 11 free?

624


How does indexof work?

609


Can we access the non-final local variable, inside the local inner class?

621


What is the difference between preemptive scheduling and time slicing in java programming?

646


What is functional interface in java example?

624


Define a java class.

926


Explain enumeration in java?

662


What is the use of isempty in java?

641