Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is Recursion Function?

1213


What is array and arraylist in java?

1122


What is string array?

1075


What is thread safe singleton?

959


What is the use of StringTokenizer class?

1077


What is collection class in java? List down its methods and interfaces.

973


How to declare objects of a class ?

1090


Can we change the value of static variable?

969


Explain the difference between association, aggregation and inheritance relationships.

1099


What is a loop java?

1072


What is the difference between jfc & wfc?

1083


How do you escape json?

1002


Can we declare register variable as global?

940


What is the internal implementation of set in java?

947


What is difference overloading and overriding?

1181