main

in 'public static void main', what does 'main' mean?
[63 byte] By [maria_vellaa] at [2007-11-26 14:25:34]
# 1
it's just called that!It means it is the entry point into a java app (if declared properly).Ted.
ted_trippina at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 2
There is a river in Germany called Main, but it is capitalized, and Java is case sensitive.
BIJ001a at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 3
main is a method that will be invoked everytime the class is called or ran. You need a main most of the time in your class defintions for your program to be run.
Lisa_ga at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 4
why don't you read some books or a tutorial or something, rather than ask the forum to define and explain every last bit of code or terminology you stumble upon
georgemca at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 5
> main is a method that will be invoked everytime the> class is called or ran. You need a main most of the> time in your class defintions for your program to be> run.nonsense. only if you're writing noddy 1-class programs
georgemca at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 6
i asked only the two words which i didn't understand from the books i read. i have many books but couldn't find a good answer. i tried writing to this forum hoping someone can answer me.
maria_vellaa at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 7

> i asked only the two words which i didn't understand

> from the books i read. i have many books but couldn't

> find a good answer. i tried writing to this forum

> hoping someone can answer me.

ok. it's just you're showing all the signs so far of someone who's going to be here for months, asking for an explaination of everything, bit by bit!

the word 'main' is the name of the method - I expect you already know that bit, if so, sorry! - and the typical JVM takes a class name as an argument, and looks for a method that is exactly public, static, void, called 'main' and takes an array of strings as it's only argument. they could have chosen any name they wanted, but chose main as a throwback to 'C' (probably actually a precursor to 'C') in which the main function serves a similar purpose. it's called main because, well, it's the main entry point, the name just makes sense

georgemca at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 8
10x don't worry i will not be asking any more questions for the time being as that was just a question i had for homework and was not sure what it was. That's it.
maria_vellaa at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 9
no problem. ask as many questions as you like, just not ones you could find the answer for yourself on google or something! that really pisses people off round here :-)
georgemca at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 10
i thought this was the section for the people who are new to java not for people who are experts!!!!!
maria_vellaa at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 11

> i thought this was the section for the people who are

> new to java not for people who are experts!!!!!

yeh, it is. but you don't need to be a java expert to look something up in the documentation, or do a quick search of the internet! questions that the poster could easily find the answer for themselves tend not to get answered here

georgemca at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 12
what ever!!! i thought forums are good if you need any help but i was wrong. and i did not ask you something which does not have to do with java either.
maria_vellaa at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 13

> what ever!!! i thought forums are good if you need

> any help but i was wrong. and i did not ask you

> something which does not have to do with java either.

what are you on about? I've answered your question!

just when I thought you didn't have the typical newbie chip on your shoulder....

georgemca at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 14

> > what ever!!! i thought forums are good if you need

> > any help but i was wrong. and i did not ask you

> > something which does not have to do with java

> either.

>

> what are you on about? I've answered your question!

>

> just when I thought you didn't have the

> typical newbie chip on your shoulder....

I see more than a chip there; it looks more like a boulder.

warnerjaa at 2007-7-8 2:18:35 > top of Java-index,Java Essentials,New To Java...
# 15
a boulder on the shoulder, ehhow about an over-the-shoulder boulder-holder?
georgemca at 2007-7-21 16:10:10 > top of Java-index,Java Essentials,New To Java...
# 16

Good day Friend!

let me say java is an enhanced version of c and c++

It follows the same syntax & procedure of c and c++

Funtion of main :

this main method is also a function in java. but before we start doing calculations we need to something to initialise . so java developers declared main function to be called first during every execution and to initialise and to call others

Some Funny things:

Some people are saying that the word comes from the river Main in Germany.

because it is also doing the same thing as Main function

with regards

vasu_gb@yahoo.co.in

vasu_gba at 2007-7-21 16:10:10 > top of Java-index,Java Essentials,New To Java...
# 17

> in 'public static void main', what does 'main' mean?

Well.

'main' is a Method that java launcher tool uses to start an application.

NOTE: there is slight difference in a java class and java application caused by main method.

class MyClass {

//code here

}

Class YourClass {

//code here

public static void main(String[] args) {

//code here

}

}

MyClass is just a class of java, will be compiled but not run coz did't have main method.

C:\javac MyClass.java // fine

C:\java MyClass // Error

YourClass is not only a class but also a java application that you can run.

C:\javac YourClass.java // fine

C:\java YourClass // fine

Hope its clear to you.

New-Drop@Java-Seaa at 2007-7-21 16:10:10 > top of Java-index,Java Essentials,New To Java...
# 18
> it's called main because, well, it's the main entry point, the name just makes senseThere were thoughts to define alternate entry points of an executable on the C language level, but this idea was abandoned. The name of the main entry point remained.
BIJ001a at 2007-7-21 16:10:10 > top of Java-index,Java Essentials,New To Java...