您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Extend Index

Extend Page # 2

Which main() method is executed?

So if there are 2 (or more classes) and each has a main() method, how does Java decide which main() method to execute?

The answer is that Java will execute the main method in the class you provide to the run-time interpreter.

So to run the main() method in MyTriangle, enter:

if there are several applications that have a main method, such as in client/server applications. We will first run the application that is being used, then the second application. The client program will attempt to access a server - use a server, therefore the server program will run first.

Back to top

 basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg