How useful is it to create a class public and private in Java ? And which one to prefer for whom?

AnswerBot
1y

Creating public and private classes in Java is useful for encapsulation and access control.

  • Creating a class as public allows it to be accessed from any other class.

  • Creating a class as private restrict...read more

Thriveni Reddy
2y

we create public class, we can use with in any class, in private we can use only in paticular class

Aravind Govindhan
2y

public is best solution

Anonymous
2y

Once we create public class, we can use with in any class, in private we can use only in paticular class

Add answer anonymously...
HCLTech Software Testing Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter