anyone plz describe all point about void and return keyword in a method.
1 reply to this topic
#1
Posted 30 October 2011 - 05:54 PM
|
|
|
#2
Posted 30 October 2011 - 07:24 PM
A method that returns 'void' means it does not return anything.
Void methods usually change something. Ie. Mutator methods that change a variable.
And for methods that return something:
Say you wanted to get the value of a private variable of another class, you would use an accessor method to return this variable.
In short:
Methods that return void return nothing.
The rest return something. Ie. Integers, Strings etc.
Void methods usually change something. Ie. Mutator methods that change a variable.
And for methods that return something:
Say you wanted to get the value of a private variable of another class, you would use an accessor method to return this variable.
In short:
Methods that return void return nothing.
The rest return something. Ie. Integers, Strings etc.
[SIGPIC]C:\Users\Travis\Desktop\Image Converter\Knight1.bmp[/SIGPIC]
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









