Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes use of this() function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "use of this() function" Watch "use of this() function" New topic

use of this() function

Rajesh Veluchamy
Ranch Hand

Joined: Jan 15, 2008
Posts: 47
1.what is the use of "this();" in EmailAct constructor

2.should "this();" function call be first line only?

-Rajesh.V<br /> Software Consultant
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14917

It calls the constructor of the class EmailAct that takes no arguments. Note that the code above will not compile, because class EmailAct doesn't have a constructor without arguments. I suspect that you copied and pasted part of the code and left something out.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Rajesh Veluchamy
Ranch Hand

Joined: Jan 15, 2008
Posts: 47

Thanks for your Kind your reply
It is sorta covered in the JavaRanch Style Guide.
subject: use of this() function
It's not a secret anymore!