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...

Why only one Class is public in one file? Explain in
details. Thanks in Advance.

Answer Posted / madan

public static void main(String args[])

this is command line args.. we need to declare public because, this is the main method, from any class, any package, we have to call, so it will be public.. same as class is also public...suppose, if u declare two class as public, it show error, we have to save a file somefile.java...

i think u understood based on above explanation..

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why stringbuilder is not thread safe in java?

1016


What is the static keyword?

1086


What is the difference between heap and stack memory?

1198


How can you handle java exceptions?

1032


What are three advantages of using functions?

1011


What is a constructor overloading in java?

1041


Can we extend private class in java?

985


What is the use of put method?

954


What does %d do in java?

1045


What is difference between adapter class and listener?

1044


If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?

1044


Can we declare a static variable inside a method?

1002


Is list thread safe in java?

923


What is a prefix function.write down a code to compute prefix function.

1059


What do heavy weight components mean in java programming?

953