Previous in Forum: Failure to detect USB hard drive - 200GB.   Next in Forum: Search engine software.
Close
Close
Close
5 comments
Rate Comments: Nested
Active Contributor

Join Date: Dec 2008
Location: kakinada
Posts: 17

Java Programming Examples

12/11/2008 8:26 PM

Hi,i encounter a question that can we write a normal java program without using "public static void main(String args[])"?

If possible give a small example?

thanking you

__________________
Arise, awake and stop not still the goal is reached.....
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Power-User

Join Date: Jul 2008
Location: United States of America
Posts: 429
Good Answers: 3
#1

Re: Java programming

12/11/2008 11:21 PM

No.

__________________
EditorGBAnalysts - Give a boy fish and he will eat may be for a day, but teach him how to fish and he will eat everyday.
Register to Reply
Anonymous Poster
#2

Re: Java Programming Examples

12/12/2008 10:59 AM

Depending on what you are meaning by "normal java program". You can write a Java Applet which lack a main() function, they cannot execute by themselves, but is run within a browser, that you call from a Web page. If you include an applet in a Web document and publish it on the Internet, anyone can run it without having to download it.

public class "Java program name" extends JApplet {

.

.

}// end class

Register to Reply
Active Contributor

Join Date: Dec 2008
Location: kakinada
Posts: 17
#3
In reply to #2

Re: Java Programming Examples

12/12/2008 8:12 PM

I am not asking about Applet programs which can be executed with lack of main() function. I am facing the program with core java concepts.

ex:-

class Hello

{

public static void main(String args[]) {

System.out.println("Hello world");

System.out.println("I am dhanavr");

}

}

Can we write the above program without using main() function?

__________________
Arise, awake and stop not still the goal is reached.....
Register to Reply
Active Contributor

Join Date: Dec 2008
Location: Minnesota. United States
Posts: 18
Good Answers: 1
#4

Re: Java Programming Examples

12/13/2008 11:21 AM

A big NO. as far as your program has a driver or the main executable class, it must have a main. other class just have" public class ..." in them but the driver that executes must always have the "public static void main(String args[])", sorry :) . The "main(String args[])" tells the compiler that that is the main program file to run

__________________
Rexy
Register to Reply
Active Contributor

Join Date: Nov 2007
Posts: 15
#5
In reply to #4

Re: Java Programming Examples

01/21/2009 9:58 AM

I have a case as to collect company divisions data to corporate server through local comPuters. Would database design to use Java PROGRAMING make web or to use ACESS is best bet? thanks

Register to Reply
Register to Reply 5 comments
Copy to Clipboard

Users who posted comments:

Anonymous Poster (1); dhanavr (1); editorgbanalysts (1); rexeken (1); Robeert (1)

Previous in Forum: Failure to detect USB hard drive - 200GB.   Next in Forum: Search engine software.

Advertisement