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 file in java?

1082


what is predefined function in java?

1030


What is the scope or life time of instance variables?

1162


How to print an arraylist in java?

1165


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

1148


Can we initialize the final blank variable?

1130


Why is inheritance used in java?

1175


Which package is imported by default?

1132


enlist some features of jdk.

1005


What does java ide mean?

1211


What are the supported platforms by java programming language?

1089


How to make a read-only class in java?

1238


What are filterstreams?

1116


What does %d do in java?

1091


Why we override equals() method?

1082