Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do empty curly brackets/braces mean in Java?

Tags:

java

Here is the whole source code:

http://zerioh.tripod.com/ressources/sockets.html

Here is the code I want to highlight:

Provider(){}

What does this line means? Thanks.

like image 668
DNB5brims Avatar asked Feb 29 '12 07:02

DNB5brims


2 Answers

It means that there's nothing to execute in this Constructor. Usually Java provides this by default so writing down Provider(){} is not necessary.

The main difference between this one and the one that is provided by the compiler by default is that the access is restricted since it's not public.

like image 130
javaCity Avatar answered Oct 23 '22 04:10

javaCity


It is a constructor with default accessibility.

like image 44
thumbmunkeys Avatar answered Oct 23 '22 05:10

thumbmunkeys