nextRound
TechnologiesCoding ProblemsBookmarksLearning PathsLogin
nextRound
TechnologiesCoding ProblemsBookmarksLearning PathsLogin
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Mock Interviews
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

Questions
2 of 7
1List all Access Modifiers (public, private, protected, internal/package-private).
2What is the default access modifier for a class in Java/C#?
3What is protected? How is it different from private and public?
4What is internal (C#) or Package-Private (Java)? Why is it useful?
5Can a Derived class access a private protected member? (C# specific)
6How do access modifiers affect the Overriding process? Can you make an overridden method more restrictive?
7What is the difference between const and readonly (C#) / final (Java)?
OOPSOOPS
Basics
Inheritance and Composition
Polymorphism
Interfaces and Abstract Classes
Access Modifiers and Scope
Advanced Concepts and Design Principles
Trees
Real-World Design and Architecture Scenarios
02 / 07

What is the default access modifier for a class in Java/C#?

Difficulty: 2/10

Default Class Accessibility

The answer differs between Java and C#. In Java, a top-level class with no modifier has package-private accessibility, meaning it is accessible only within the same package. A nested Java class follows member access rules. In C#, a top-level class defaults to internal accessibility, while a nested class defaults to private when no access modifier is specified. This distinction is important when designing module and assembly boundaries.

javascript
  1. 1

    Java top-level class without a modifier: package-private.

  2. 2

    C# top-level class without a modifier: internal.

  3. 3

    Java and C# have different defaults for nested types.

  4. 4

    Explicit visibility is often preferable for public APIs because it makes intent clear.

Follow-up Questions

  • What is the default access modifier for a Java interface?
  • What is the default access modifier for a C# nested class?
  • What is package-private in Java?
  • What is internal in C#?
Sharethis question

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.