Can I limit the methods another class can call in Java?

前端 未结 6 910
猫巷女王i
猫巷女王i 2020-12-11 15:01

Let\'s assume I have classes A, B, and C where class C has readable and writable properties:

public class         


        
6条回答
  •  旧巷少年郎
    2020-12-11 15:18

    Not that you'd want to, but you could go up the stack trace (create an exception) and check the class that's calling your increment method.

提交回复
热议问题