• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

whats the differenc

 
Ranch Hand
Posts: 77
Android MyEclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


out put : Constructor2

My question is , defalut constructor will not have any return type, its universal truth.

But is there any differece in return type as void and not having return type.
both gives same meaning right?

Thanks,
Damodar.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

both gives same meaning right?


Wrong. public void Test4() isn't a constructor at all, it's a method.

edit

defalut constructor will not have any return type


A constructor, default or otherwise, does not have a return type.
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'void' IS a return type. a constructor CANNOT have ANY return type - not even 'void'.

it is sort of like the difference between someone saying "i'm not going to answer you" and saying nothing at all.
 
damodar kumar
Ranch Hand
Posts: 77
Android MyEclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your suggestions

Damodar.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:it is sort of like the difference between someone saying "i'm not going to answer you" and saying nothing at all.


I like that
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic