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
can rmi and corba based applications interact ?
What does it mean that a class or member is final?
Can you change array size in java?
What is reverse function?
How do you check if a number is a perfect square?
How do you add an element to an arraylist in java?
explain different ways of using thread? : Java thread
What is the differences between c++ and java? Explain
What is the difference between an object-oriented programming language and object-based programming language?
What is the difference between integer parseint and integer valueof?
Is java free for commercial?
What is the use of generics? When was it added to the Java development Kit?
What’s the difference between applets and standalone program?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.
What are the methods used to implement for the key object in the hash map?