+ 1

Java

Why I need to write public static void main(String[]args)

6th Aug 2018, 4:15 PM
Sudhanshu Ranjan
Sudhanshu Ranjan - avatar
3 RĂ©ponses
+ 4
You need to write this because this is the entry point of java.if you don't write your code never compile.the inventor of java create a java like this so it is necessary to write a main method.
7th Aug 2018, 2:37 AM
Maninder $ingh
Maninder $ingh - avatar
+ 1
why we write import java.io.*;
6th Aug 2018, 4:16 PM
Sudhanshu Ranjan
Sudhanshu Ranjan - avatar
+ 1
it's the entry level method in java... For eg in C++ your code starts with main function like that in java we write public static void main ( String[] args ) function & we import packages ...with writing import keyword ...
6th Aug 2018, 4:32 PM
Rishabh
Rishabh - avatar