Can main method declared final

Can main method declared final

Answer: Yes we can declared final to main methoed and JVM wills sill find it, JVM matches method name public static void main(String args) to run the program. Please see example below:

package com.javahonk.multipleTest;

public class MainMethodTest {
	final public static void main(String[] args) {
		System.out.println("main(String[] args)");
	}	
}

 

Output:

Can main method declared final

Leave a Reply

Your email address will not be published. Required fields are marked *