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


can two class in a code be public??if yes then how??

Answers were Sorted based on User's Feedback



can two class in a code be public??if yes then how??..

Answer / sreejesh1987

One java source file must have only one top-level(top level means not an inner class) public class with the same name as the name of the source file .


You can have inner classes to a class which are public. Hence in this way it is possible to have more than one public class in a single file.

Is This Answer Correct ?    11 Yes 2 No

can two class in a code be public??if yes then how??..

Answer / siva

NO only one class should be public if we write multiple
classes in a same file.we can write multiple class files in
a single file.if main() is there in one of the classes then
it should be declare as public.

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the syntax and characteristics of a lambda expression? Explain

0 Answers  


what is difference between throw and throws in exception?

48 Answers   Spenco,


What collections you have worked on? Internal working of Hashmap?

1 Answers   Bravura Solutions,


What is the hashcode () and equals () used for?

0 Answers  


adapter class ?

2 Answers  


How to convert String into primitive datatype.

6 Answers  


Why java is called not pure object oriented language?

0 Answers  


What is static and final keyword in java?

0 Answers  


How to declare an arraylist in java?

0 Answers  


How to Create A Wapper Class in core Java and Why are Use in java?

2 Answers   Amdocs,


whats the life cycle of jsp

2 Answers   Satyam,


What are triggers in DB? Explain their types. How do they work?

0 Answers   Amdocs,


Categories