Abstraction in Java?

前端 未结 10 1825
鱼传尺愫
鱼传尺愫 2021-02-15 00:43

Today i heard from my friend, that encapsulation is not only achieving information hiding but also abstraction. How does it achieve?

public class employee {

           


        
10条回答
  •  余生分开走
    2021-02-15 01:15

    I don't think you can prove encapsulation with that particular example. It's more like this:

    interface NameService {
        String getName();
    }
    

    Now, tell me: does a class implementing this interface get the name from a flat file, a database, a nosql store, or someplace else?

提交回复
热议问题