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 java does not support pointers?

1093


Can constructor be synchronized?

995


What is the difference between super class & sub class?

1283


What are the uses of java?

1141


How many bytes is string in java?

1334


Can static methods access instance variables in java?

1145


Can you call a method on a null object?

1063


Why you should not use singleton?

1028


What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?

1242


What is the range of the short type?

1066


What is basic syntax?

1112


Why do we need wrapper class?

1040


why are there separate wait and sleep methods? : Java thread

1082


How do you remove duplicates from an array in java?

1015


What is flush () in java?

1072