• Post Reply Bookmark Topic Watch Topic
  • New Topic

constructor not getting called  RSS feed

 
shannnon burnett
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello;

I have:


my out put is:
A.main


but it should be:
A.main
A.constructor


any thoughts.

thanks
 
Greg Brannon
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Constructors don't have a return type.
 
Igor Mechnikov
Ranch Hand
Posts: 100
Chrome Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Brannon wrote:Constructors don't have a return type.


What is



then?

Compiler does not seem to care.


[HENRY: Deleted lots of whites space that messed up forum formatting]
Edit. Added to the pause, Borat-style. iv
 
Henry Wong
author
Sheriff
Posts: 23284
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ilya Mechnikov wrote:
Compiler does not seem to care.


Having methods and constructors with the same name is valid in Java. There is nothing for the compiler to flag as an error.

Henry
 
swapnil kataria
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
constructor can not have return time, what you have defined that is a method, not constructor
 
shannnon burnett
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
removing the return type did it. thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!