Skip to content

W3schools

MENUMENU
  • Academics
    • Physics
    • Chemistry
    • Math
    • Biology
    • English
    • Hindi
    • Wiki
  • Tutorials
    • Quartz scheduler
    • Log4j
    • JUnit
    • Java Mail
    • Java Generics
    • JAXB
    • Jsoup
    • JSON
    • XML Parser
    • Data structure
    • Assembly
  • Java
    • Java
    • String handling
    • Exception handling
    • Multithreading
    • Input output
    • Collection framework
    • Java date time api
    • Java regex
    • Java annotations
    • Design principles
    • Design patterns
    • Java sample programs
    • Java 7 features
    • Java 8 features
  • Android
  • Servlet
  • JSP
  • Spring
    • Spring
    • Spring AOP
    • Spring DI
    • Spring MVC
    • Spring spel
    • Spring boot
    • Spring security
  • Hibernate
  • Ajax
  • WS
    • Stories
  • Python
  • Web
    • HTML
    • CSS
    • Javascript
    • jQuery
    • jQuery UI
    • PHP
    • TypeScript
    • ReactJS
    • BackboneJS
    • Bootstrap
      • Bootstrap
      • Bootstrap 4
    • XML
      • XML
      • XML DOM
      • XPath
      • XSLT
      • DTD
      • XSD
      • XQuery
  • Angular
    • AngularJS
    • Angular 7
    • Angular 8
  • DB
    • SQL
    • MySQL
    • Oracle
    • PostgreSQL
    • PouchDB
    • MongoDB
    • SQLite
    • PL/SQL
    • DBMS
  • C
  • Q&A
    • C Q&A
    • C# Q&A
    • CPP Q&A
    • StackOverflow
  • Quiz
  • More
    • CPP
    • JSF
    • JDBC
    • JPA
    • WordPress
    • Maven
    • Shell/Bash
    • Julia
    • Ant Tutorial
    • Scala
    • World
    • JAR
    • WAR
MENUMENU
  • Academics
    • Physics
    • Chemistry
    • Math
    • Biology
    • English
    • Hindi
    • Wiki
  • Tutorials
    • Quartz scheduler
    • Log4j
    • JUnit
    • Java Mail
    • Java Generics
    • JAXB
    • Jsoup
    • JSON
    • XML Parser
    • Data structure
    • Assembly
  • Java
    • Java
    • String handling
    • Exception handling
    • Multithreading
    • Input output
    • Collection framework
    • Java date time api
    • Java regex
    • Java annotations
    • Design principles
    • Design patterns
    • Java sample programs
    • Java 7 features
    • Java 8 features
  • Android
  • Servlet
  • JSP
  • Spring
    • Spring
    • Spring AOP
    • Spring DI
    • Spring MVC
    • Spring spel
    • Spring boot
    • Spring security
  • Hibernate
  • Ajax
  • WS
    • Stories
  • Python
  • Web
    • HTML
    • CSS
    • Javascript
    • jQuery
    • jQuery UI
    • PHP
    • TypeScript
    • ReactJS
    • BackboneJS
    • Bootstrap
      • Bootstrap
      • Bootstrap 4
    • XML
      • XML
      • XML DOM
      • XPath
      • XSLT
      • DTD
      • XSD
      • XQuery
  • Angular
    • AngularJS
    • Angular 7
    • Angular 8
  • DB
    • SQL
    • MySQL
    • Oracle
    • PostgreSQL
    • PouchDB
    • MongoDB
    • SQLite
    • PL/SQL
    • DBMS
  • C
  • Q&A
    • C Q&A
    • C# Q&A
    • CPP Q&A
    • StackOverflow
  • Quiz
  • More
    • CPP
    • JSF
    • JDBC
    • JPA
    • WordPress
    • Maven
    • Shell/Bash
    • Julia
    • Ant Tutorial
    • Scala
    • World
    • JAR
    • WAR

can we declare the main method as final?

by

Yes, we declare the main method as final.

public static final void main(String[] args){}

Example

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

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

Output

Final main method

Final main method

Java interview questions on final keyword

  • what is final in java?
  • What is final variable in java?
  • What is final method in java?
  • What is final class in java?
  • What is blank final variable in java?
  • What is static blank final variable in java?
  • What is final parameter in java?
  • Can we initialize blank final variable in java?
  • Can we declare the main method as final?
  • What is the use of final keyword in java?
  • Can we change the state of an object to which a final reference variable is pointing?
  • Difference between abstract method and final method in java?
  • Can we change the value of an interface field?
  • Can we declare constructor as final in java?
Content Protection by DMCA.com
Please Share
Categories Interview questions
Post navigation
Initialize blank final variable in java
Can we change the state of an object to which a final reference variable is pointing?

Related Posts

  • printStackTrace in java
  • Iterator vs ListIterator vs Enumeration in Java
  • does constructor return any value in java?
  • Initialize Map Java
  • are static members inherited to subclasses in java?
  • can we declare local inner class as abstract?
  • StackOverflowError in java
  • Final method in java
  • Constructor vs method in java
  • Abstraction vs Encapsulation in java
  • Call string class methods using string literals
  • Can static method be overridden?
  • Static blank final variable in java
  • can an interface be declared final in java?
  • Mutable and immutable objects in java
  • Final, finally and finalize in java
  • ArrayStoreException in java
  • Rethrowing an exception in java
  • can we use abstract and final both with a method?
  • Immutable String Java

powered by Advanced iFrame free. Get the Pro version on CodeCanyon.

powered by Advanced iFrame free. Get the Pro version on CodeCanyon.

powered by Advanced iFrame free. Get the Pro version on CodeCanyon.

© Copyright 2023 W3schools.blog. All rights reserved. SiteMap