Campbell Ritchie wrote:The void keyword is not so much a erturn type as an absence of return type.
Exactly what Campbell says. I just want to give you an example that gives the clear understanding of void. In swing/AWT (It could be true for any other
Java frameworks. I tested it in Swing/AWT. So, please conside this). For an analogy, We have simple user login page. In this page we are first checking whether user filled username and password or not? If
No then we will simply put a check
else yes then
Create Database Connection Validate User And other related user authentication task
So in first check (#1) we say to compiler if something goes wrong then please do not proceed further.
I think that will be sufficient to explain. In case of any doubt please let me know.