What happens when a main method is declared as private?
Answer Posted / kundan
when u will declare main method is private
it will successfully compile and Run
and result will publish,
class A
{
int x=7;
void show(){
System.out.println(x);
}
}
class Test
{
private static void main(String args[])
{
A a = new A();
a.show();
}
}
out put:-
Main method not public
| Is This Answer Correct ? | 7 Yes | 4 No |
Post New Answer View All Answers
how to run ecllipse with jettyserver for windows environment using batch file
What is classpath?
What is the synonym of procedure?
What is adapter in java?
Differentiate between == and equals().
Explain the concept of hashtables?
What is java volatile?
What is break and continue statement?
What is the difference between jdk and jre?
What are the legal parameters?
How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?
What is function overriding and overloading in java?
What is the meaning of find and replace?
What is private static in java?
can used Protected Class outside Function.?