What is the need to declare main() method as static in Java?
Answers were Sorted based on User's Feedback
Answer / juhi
If main method is static it should not be able to access any
other methods(other than static methods). but this is not
the case y?
Is This Answer Correct ? | 1 Yes | 0 No |
We know very well that when we want to call any method without creating Class object in which that method is reside,this will
be perform by "static" keyword.And in java main()always call by JVM,So we can call main()without instance create with the help of jvm.Therefore we needed static with main();
INTERNALLY MAIN()CALL WITH THE HELP OF TRY-CATCH BLOCK
try{
ClassName.main();
}
catch(Exception e)
{
---------------
}
Is This Answer Correct ? | 1 Yes | 0 No |
If you’re overriding the method equals() of an object, which other method you might also consider?
What is the point of lambda expressions?
How do I run a java project in netbeans?
Is it better to learn java or python?
Can I have multiple main methods in the same class?
How do I open the java console in windows 10?
What is meant by pass by reference and pass by value in java?
What is profile in java?
Why is lambda expression used?
Who developed rxjava?
If one class havent the constructor, it has normal method, then can i use super keyword to call the method form the sub class and vice verse?
there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2 seats. One person can reseve only 5 seat at a time. If person reserving seat , the care is atken that he may get all in row. if seats are not available in row then the arrangement is so that person group get nearby seats. the following class is given public class seat { char name; int seat; boolean isSeatempty } 1.Draw require class digram and object diagram. 2.Write function seatallot(int noofperson) to allocate seat with seat nuber printed for the each name.