answersLogoWhite

0

Do void methods have parameters

Updated: 12/16/2022
User Avatar

Wiki User

14y ago

Best Answer

A void method is just like any other method; it may or may not have parameters.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Do void methods have parameters
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How many formal parameters can be included in a function definition?

Zero or more. Note: if zero, write void: int foo (void)


Define method overloading and write two method headers that together exhibit overloading?

Method overloading is when two or more methods have the same name, but the computer can differentiate between the methods by looking at the parameters. Example: public static void go(int x) public static void go(double x) If you pass an int, the first method would be called. If you pass a double, the second method would be called


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.


How do you write and invoke methods that take parameters?

// This method will accept an integer, double, and string as parameters // To invoke it, simply call testMethod(0, 1.1, "hello"); // (or whatever values you wish to substitute in) void testMethod(int param0, double param1, String param2) { System.out.println("Accepting parameter: " + param0); System.out.println("Accepting parameter: " + param1); System.out.println("Accepting parameter: " + param2); }


What is polymorphism in programming?

Polymorphism is the method in which a java program can have more than one function(or method) with the same name but different method signatures(different parameters or return type). possible allowance: void s() void s(int a) void s(int a,int b) void s(float a) int s()

Related questions

What is the use of void data types?

When a function declares it returns void, it means it does not return anything. Sometimes the function doesn't need to return anything, so using void is convenient. In C: using voidinstead of parameters means 'there's no parameters'


What is the significance of using void in functions parameters lists?

It means that the function doesn't have parameters.example:int foo (void); -- it is a prototype for function 'foo', having no parametersint bar (); -- it is not a prototype as it says nothing about the parameters


What is the general format for user defined functions in c?

returntype name ( parameters )statementblockif there is no returntype or parameters, 'void' is used instead.


How many formal parameters can be included in a function definition?

Zero or more. Note: if zero, write void: int foo (void)


Why you are using VOID in C programming?

You don't use 'VOID', but 'void'. It means different things, such as:- void as function type means no return value- void as function parameter means no parameters- 'void *' as pointer-types means generic pointer


Why you use viod in c?

It's void, and you use is for different purposes, like:a function doesn't have return value: void fun () ...a function doesn't have parameters: ... fun (void) ...generic pointe: void *ptr;r


Is it possible to overload the overrided methods why?

Yes, you can overload overridden methods. In the example below, class B overrides all methods of class A and it has an additional overloaded version. While useless, this code will compile. class A { void f() { } void f(int n) { } } class B extends A { void f() { } void f(int n) { } void f(int n, int m) { } }


What is method overloading?

Method overloading is when you have multiple methods in a class that have the same name but a different signature.Ex:public void print (String s){}public void print(int a) {}If we use more than one same type of method but different parameters or parameter list with same no. of parameters within same class than it is called methodoverloading.if we use more than one different type of method within same class than we dont call it method overloadingfor example:public void add(int a , int b){systemout.println(a+b);}public void add(double a , double b){systemout.println(a+b);}public void add(string a , string b){systemout.println(a+b);}


Define method overloading and write two method headers that together exhibit overloading?

Method overloading is when two or more methods have the same name, but the computer can differentiate between the methods by looking at the parameters. Example: public static void go(int x) public static void go(double x) If you pass an int, the first method would be called. If you pass a double, the second method would be called


How can objects be passed as a function parameters in c?

Possible ways: void byvalue (MyClass param); void byptr (MyClass *paramptr); void byref (MyClass &paramref); MyClass c; byvalue (c); byptr (&c); byref (c);


How do you overload static methods in java?

Just create two methods with the same name, but with different types or numbers of parameters.


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.