Java Interview Question Part 2
Q. Different access modifier in java? A. A private member is only accessible within the same class as it is declared. A member with default ( no access modifier) is only accessible within classes in the same package. A protected member is accessible within all classes in the same package and within subclasses in other packages. A public member is accessible to all classes. The protected access modifier is accessible within the package and outside the package but through inheritance only. Q. @Service and @Component A. For more annotation: https://springframework.guru/spring-framework-annotations/ @Service This annotation is used on a class. The @ Service marks a Java class that performs some service, such as execute business logic, perform calculations and call external APIs. This annotation is a specialized form of the @ Component annotatio...
Comments
Post a Comment