7 ways of declaring main in java

hi,

i know there are 7 ways to declare main in java
as

1.public static void main(String args[])
2.static public void main(String args[])

but what are the other ways?

but only change first two keywords
i.e. public and static
and use the required keywords.

this is the question given to me.
 
551
1
Apparently you can declare main() as private or protected, too. The code will compile, but you'll get an error when you run the program saying main() isn't public. I didn't know that. Also, I don't think you can remove "static" as you'll get an error when you try to compile if you do. Why do you want to declare main() in different ways anyway?
 

Related Threads for: 7 ways of declaring main in java

  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
21
Views
3K
Replies
6
Views
2K
Replies
1
Views
501
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
9
Views
10K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
9
Views
7K
Top