
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
How to write an empty function in Java
Let us see how to write an empty function in Java −
Example
import java.util.Vector; public class Demo{ public static void my_empty_fun(){ } public static void main(String[] args){ System.out.println("In the main function"); my_empty_fun(); } }
Output
In the main function
An empty function is basically creating a function without defining any operations inside it. A class named Demo contains an empty function named ‘my_empty_fun’ which is just completed by placing two flower brackets, without adding any functionality into it. In the main function, a print statement is written after which the empty function is called. Since there is no functionality defined for it, it does nothing.
- Related Articles
- How to write an empty function in Python?
- How to empty an array in Java
- Java Program to Empty an ArrayList in Java
- How to validate if JTable has an empty cell in Java?
- How do you create an empty list in Java?
- How to Check if an Array is Empty or Not in Java
- How to create and set an Empty Border from BorderFactory class in Java?
- How to empty an array in JavaScript?
- In Javascript how to empty an array
- How to add empty border to JPanel in Java?
- How to write a class inside an interface in Java?
- How to create an empty list in Python?
- How to initialize an empty DateTime in C#
- How to create an empty VIEW in MySQL?
- How to create an empty matrix in R?

Advertisements