Quite confusing line of main in java. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Quite confusing line of main in java.

hey guys may you please give me a detailed explaination on this line of main . class MyClass { public static void main(String[] args) Well im an absolute begginer to java ,you can say

22nd Jul 2018, 3:11 AM
Vishal Ghuman
Vishal Ghuman - avatar
3 Réponses
+ 1
public means that it is accessible from any source, static means that you can call it without instantiate it, void is used when you make a function without return value, and String[] args is used to save the parameters into a String array Hope it helps you!
22nd Jul 2018, 3:20 AM
Guillem Padilla
Guillem Padilla - avatar
+ 1
what is instantiating?
22nd Jul 2018, 3:22 AM
Vishal Ghuman
Vishal Ghuman - avatar
+ 1
Read this explanation from Peter Kottas :) Class in programming is just a template that defines some data and functionality. Only when an instance of this template is created, it becomes and actual object, kept in memory during the run-time. 
22nd Jul 2018, 3:26 AM
Guillem Padilla
Guillem Padilla - avatar