answersLogoWhite

0

// C

int main(int argc, char** argv) {

return 0;

}

// Java

class MainClass {

public static void main(String[] args) {

}

}

Differences:

* Java main method must be in a class; C has no class, so no such requirement exists. * Both accept an array of command-line args. * ** Java arrays know how long they are; C does not and thus the main function must have an additional parameter to know the length of the array. * The Java main method has a specific format; the C main function seems to be allowed to differ. * ** The C main function seems to be able to accept different numbers of arguments and have different return types (assuming the implementation allows it).

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is the main difference between UNIX and JAVA?

Unix is an operating system, Java is a language.


Who invoke main function in java?

The Java Runtime Environment invokes main methods.


Main difference between Array List and Vector in Java?

List is not sync'd as a vector is.


What is the main difference between java and dotnet?

java is from sun and .net is from microsoft, java is a language + runtime and .net is run frame that supports multiple language.


Is main a predefined function in java?

No. It is a user defined function which the person who is creating the java class has to code by himself.


What is the difference between function and method?

functions have independent existence means they are defined outside of the class e.g. in c main() is a function while methods do not have independent existence they are always defined inside class e.g. main() in Java is called method. ######## I've been studying OOP lately and had this question myself, so I will share my thoughts; I was taught that "A Function should do 1(one) thing and do it well." In specific Regards to PHP; The difference between a Method and a Function is that a Method is tied to a specific class. Hope this helps. -------------------------------------------------------------------------------------------------------- function can return value where as method can't that is the main difference between function and method --------------------------------------------------------------------------------------------------- Actually you are describing the difference between a function and a procedure. Function returns a value, procedure does not unless you are using c#, then everything is a function. In c# a function, to paraphrase the first answer, does and thing and does it well. A method contains functions. The most important method is the Main method. All functionality of a program must be referenced in the Main method because when you run a program, it starts at the beginning of the Main method, and stops wehn it hits end of the Main method.


In java public static voidmain function denotes what?

Java's main function denotes the entry point into the execution of your program.


Can we execute java program without main function?

no


What are the main differences between Java and C plus plus?

the difference is that c plus is better because you get big grades


What is the name of the function which must be defined in a Java program?

The main function. Every program must have a main function and it must be declared static.


Difference between ASP and JSP?

The main difference between ASP and JSP is that JSP is more script like and includes Java, whereas ASP does not. Both of these are server side languages.


Is the any class containing main function in a webapplicatin?

No. Java classes in web applications do not have Main Methods.