answersLogoWhite

0

What else can I help you with?

Related Questions

What does a void method do?

In Java, this keyword is used to specify that the method has no return value.


What is the return keyword in Java?

this is the type of the value that the method returns to its caller


What is the meaning of java void keyword?

The void keyword is used to show that a method will not return a value. // no return type public void setX(int x) { this.x = x; } // returns an int public int getX() { return x; }


Void in java?

Void is a keyword in Java. It is always used in method declarations. When used in the line that declares a method, it signifies the fact that the method will not return any value. The JVM will not expect the method to return anything. Ex: public static void main(String[] args) {}


If a function does not have return type it is declared as?

If a function does not have a return type, it is declared as void. The void keyword indicates that the function does not return a value after its execution. This is commonly used for functions that perform actions but do not provide any output to the caller.


Difference in using a method that return value and method that does not return value in object orinted programming?

A method that return a value should have a return statement. The method signature should indicate the type of return value. While in the case of a method that does not return a value should not have a return statement and in the signature, the return type is void. When using a method that doesn't return a value, a programmer can not get a value from that function, but instead, it can only change variable values and run other methods.


Which Keyword is used to return some value from a function?

return var_name; e.g int fun() { int x=...; return x; }


What is wrong with not writing a return statement in value-returning method in java?

It is a syntax error, because a value returning method must return a value, and not writing a return statement with a value is tantamount to returning without a value.


Can a recursive method be void, or does it always need to return a value?

Yes, a recursive method can be void, meaning it does not need to return a value.


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.


What is the purpose of the keyword void in a function declaration?

when we declare any function with void,it doesnt return any value


What are getters and setters method?

Getter method: A getter method have its name start with 'get', and take 0 parameters, and also returns a value. Setter method: A setter method have its name start with "set", and takes 1 parameter. Setters may or may not return a value. Some setters return void, some the value set.