answersLogoWhite

0

Is 'void' a data type in java?

Updated: 10/24/2022
User Avatar

Wiki User

11y ago

Best Answer

No. The void keyword is used to signify that a method will not return any objects. For example, if you type in "double", you'll need a return statement that has a double. So "void" means that there will be nothing returned.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Not exactly. If a method has a return type of "void", it means that it returns nothing.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is 'void' a data type in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is void a data type in c?

what is void data type Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function. The another use of void is to declare the pointer in C/C++ whe It is not sure that what data type will be addressed by the pointer. eg: void *p; Here p can hold the address of int or float or char or long int or double.


What is the data type of the parameter of the second version of the method?

Given that you haven't specified the method in question it is impossible to say what the parameter's data type would be. However, in statically typed languages such as Java, the method's signature will tell you specifically which data type is to be expected: void f (int x) { // expects an argument of type int // ... } void f (float x) { // expects an argument of type float // ... }


Why use void in main of java?

No. void is not a data type. It is mandatory for all java methods to return something and if it is not going to return anything, we have to mark the method with a "void" return type to let the JVM know that it must not expect anything from the method.


Is button a data type in Java?

In Java, just about anything is defined as a class; a class is a data type, so yes.


Application of void data type in c plus plus programming language?

The voiddata type is used when a function doesn't return any value, and/or when it has no parameters at all. Pointer type 'void *' is a generic pointer.A void pointer is used when it needs to be assigned to different data types later on in a program. Since it avoids type checking, void pointers should be used with care.

Related questions

Why void is preemptive data type?

void isn't an actual data-type, preemptive(?) or otherwise.


Is void a data type in c?

what is void data type Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function. The another use of void is to declare the pointer in C/C++ whe It is not sure that what data type will be addressed by the pointer. eg: void *p; Here p can hold the address of int or float or char or long int or double.


What is the data type of the parameter of the second version of the method?

Given that you haven't specified the method in question it is impossible to say what the parameter's data type would be. However, in statically typed languages such as Java, the method's signature will tell you specifically which data type is to be expected: void f (int x) { // expects an argument of type int // ... } void f (float x) { // expects an argument of type float // ... }


Why use void in main of java?

No. void is not a data type. It is mandatory for all java methods to return something and if it is not going to return anything, we have to mark the method with a "void" return type to let the JVM know that it must not expect anything from the method.


Is button a data type in Java?

In Java, just about anything is defined as a class; a class is a data type, so yes.


Application of void data type in c plus plus programming language?

The voiddata type is used when a function doesn't return any value, and/or when it has no parameters at all. Pointer type 'void *' is a generic pointer.A void pointer is used when it needs to be assigned to different data types later on in a program. Since it avoids type checking, void pointers should be used with care.


Is float is a keyword in java?

yes, float is keyword and data type in java


Why should the java main method has the return type as void?

A void method is one that returns no value. The Java main() method is the first method to be called, therefore it doesn't need to return a value to another Java method, therefore it is declared as void. If something needs to be returned to the operating system, this is done differently, not by "returning a value" in the sense of Java.


What is the size of void data type?

Data-type void has some special features:- it doesn't have values- it doesn't have size- you cannot declare variables with it- void *pointers cannot be dereferenced


Why do you use a void pointer in a programme?

void is type of pointer that usually means that you can make it point to any data type. When you make a pointer point to somewhere its data type should match with the place where you want it to point. When you dont know the data type where it will point to then you can declare a void pointer and make it point to the data type it want.


Why java called as strong type language?

That means that Java is fairly strict about data types.


Is string is primitive or user defined data type?

String - is primitive data typestring - is user defined data type