This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread 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


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.)
 
GeeCON Prague 2014
 
subject: main() in abstract class