• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calling Multiple main methods in a Main

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have written a program in which main mathod is calling is some other main methods.But in that all the main methods are not called.
The code is as follows
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't see why this happens, everything looks ok. Are you sure?

PS: I assume MInterface is not an interface as an interface cannot contain static methods or be instantiated.
 
Pavan Chillara
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MyInterface is not an interface it is class only,The code for MyInterface is as follows

The code for MultipleMains is as follows
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MultipleMains.main() calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() which calls MultipleMains.main() which calls MultipleMains.A() until finally, the execution stack is so high that the program terminates with a StackOverflowException. The other two main()s do get called -- they just get called first, before the screen fills up with other junk.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic