0

Question about a simple java code?

public static void main(string[ ] args) what does everything in the brackets mean? Where do i need to include this line of code? also, im having trouble understanding what void and static mean thanks in advance

20th Dec 2016, 12:17 AM
Dmitrijs Kozevnikovs
2 Answers
+ 1
void mean no return type in the method, and static mean it can be run without instantiate. The line should use for main method, public mean every other class can access to it, and the array inside the bracket allow you to set argument so it can run inside the method
20th Dec 2016, 3:38 AM
Ng WeiShyang
Ng WeiShyang - avatar
0
Public : is an Access Modifier, which defines who can access this Method. Public means that this Method will be accessible by any Class(If other Classes are able to access this Class.). Static : is a keyword which identifies the class related thing. This means the given Method or variable is not instance related but Class related. It can be accessed without creating the instance of a Class. Void : is used to define the Return Type of the Method. It defines what the method can return. Void means the Method will not return any value. main: is the name of the Method. This Method name is searched by JVM as a starting point for an application with a particular signature only. String args[] : is the parameter to the main Method.
20th Dec 2016, 5:09 AM
Artemas
Artemas - avatar