• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

main() in abstract class

 
Krishna Tota
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can we write main() in an abstract class.
please explain in brief.
Thanks.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Krishna Tota:
... Can we write main() in an abstract class...

How difficult would it be to test this?
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may help:



You can execute ABS or Child..
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic