This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes main() in abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "main() in abstract class" Watch "main() in abstract class" New topic
Author

main() in abstract class

Krishna Tota
Ranch Hand

Joined: Mar 22, 2008
Posts: 40
Hi,
Can we write main() in an abstract class.
please explain in brief.
Thanks.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Krishna Tota:
Can we write main() in an abstract class.


yes,we can write.

1.Abstract class can have concrete(non-abstract) methods.
2.Abstract class constructor is invoked when the first non-abstract class (which is extends abstract class)get instantiated
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Krishna Tota:
... Can we write main() in an abstract class...

How difficult would it be to test this?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

This may help:



You can execute ABS or Child..


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

This can be as simple as adding the word "abstract" to a HelloWorld program. (No instance of the class is required because main is static.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: main() in abstract class