[HD Pg 242, Sec. 9.2.3 - valid-combinations-of-access-modifiers-abstract-final-and-static]

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
flex567
Posts: 202
Joined: Mon Apr 02, 2018 8:40 am
Contact:

[HD Pg 242, Sec. 9.2.3 - valid-combinations-of-access-modifiers-abstract-final-and-static]

Post by flex567 »

Why is allowed for an abstract class to have concrete private instance methods?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: [HD Pg 242, Sec. 9.2.3 - valid-combinations-of-access-modifiers-abstract-final-and-static]

Post by admin »

Here are some questions that you should consider:
What do you think is the relation between the two things? Why do you think it should not be allowed?
What is the purpose of an abstract class? What is the purpose of a private instance method?
If you like our products and services, please help us by posting your review here.

flex567
Posts: 202
Joined: Mon Apr 02, 2018 8:40 am
Contact:

Re: [HD Pg 242, Sec. 9.2.3 - valid-combinations-of-access-modifiers-abstract-final-and-static]

Post by flex567 »

I have found a use case for the private method:

Code: Select all

public class TestClass{

	abstract class  Cc{
		private void whap(){};
		public void doSomething(){  whap();  };
	}
	
	public static void main(String args[]){
	}
}

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests