📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
@Deprecated annotation Example
class DeprecatedDemo {
/* @deprecated This field is replaced by
* MAX_NUM field
*/
@Deprecated
int num = 10;
final int MAX_NUM = 10;
/* @deprecated As of release 1.5, replaced
* by myMsg2(String msg, String msg2)
*/
@Deprecated
public void myMsg() {
System.out.println("This method is marked as deprecated");
}
public void myMsg2(String msg, String msg2) {
System.out.println(msg + msg2);
}
public static void main(String a[]) {
DeprecatedDemo obj = new DeprecatedDemo();
obj.myMsg();
System.out.println(obj.num);
}
}
This method is marked as deprecated
10
Comments
Post a Comment
Leave Comment