Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3845534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:15:33+00:00 2026-05-19T16:15:33+00:00

We cannot declare abstract methods in interface as protected and default (even if we

  • 0

We cannot declare abstract methods in interface as protected and default (even if we don’t mention any access specifier (default) compiler takes it as public)

but we can declare abstract method in abstract class as protected and default.

Why there are different rules for abstract class and interface?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T16:15:34+00:00Added an answer on May 19, 2026 at 4:15 pm

    we cannot declare abstract methods in interface as protected and defaul

    the purpose of Interface is to just declare contract. your client will implement it and for that it must be public.

    also field in interface are public static final by default,
    public you got ,static because it can’t be instantiated without implementation and it must not be inherited also.

    Update:
    as per your question

    you want to apply some strict constraint which your implementor can’t see ..then what is the use of abstract method in abstract class that must be implemented by any concrete class in the inheritance hierarchy…then no one will be concrete class

    public class BaseAbstractClass {
      private Connection getConnection(){
          //somecode 
    
      }
    
      public boolean save(){
          //get connection and do something 
          //return ;
      }
    
    //your implementor is left to implement it , he  can use save method but can'ge see what it does i mean i doesn't have access to getConnection
      public abstract void saveEntity();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why do we declare a class as abstract? I know it cannot be instantiated,
I cannot seem to access the context object using a loop context is set:
I have an abstract class A that define abstract methods. This means that, for
How to create in C++ an abstract class with some abstract methods that I
Given an abstract interface and an implementation derived from that interface, where constructors are
I know virtually nothing about F#. I don’t even know the syntax, so I
I get this error on compile -> cannot declare field M1::sc to be of
why cannot declare const static string inside a class? Have to use static readonly
I cannot figure out how to change the title bar icon (the icon in
I cannot understand the Oracle documentation. :-( Does anybody know how to fetch multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.