Jump to content

what is void and return keywords?

- - - - -

  • Please log in to reply
1 reply to this topic

#1
prakashjangir

prakashjangir

    Newbie

  • Members
  • Pip
  • 4 posts
anyone plz describe all point about void and return keyword in a method.

#2
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
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.
[SIGPIC]C:\Users\Travis\Desktop\Image Converter\Knight1.bmp[/SIGPIC]




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users