What is the use of static keyword in "public static void
main()"

Answer Posted / rozer willis

static keyword makes the main function static.And the
advantage to make it static is that it can call other
static methods of the sane class just by their names i.e.no
need to create object.And the static method cant be
override so it prevent the main method from onerriding.

Is This Answer Correct ?    34 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a line break example?

580


Write a function to find out longest palindrome in a given string?

595


What is the file extension for java?

612


What is the difference between length and length() method in java?

648


What are the restrictions imposed on method overriding?

556






What are filterstreams?

615


Can a static class have a constructor?

522


How many bytes is a char in java?

533


Can a abstract class be defined without any abstract methods?

562


What does nullpointerexception mean?

617


What is substring in java?

617


Can an integer be null java?

559


What is split return?

494


When is the finally clause of a try-catch-finally statement executed?

504


Can a final variable be manipulated in java?

535