JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Introduction to reflection: the Class class, why it’s needed

    JAVA 25 SELF
    62 level,0 lecture
    We’ll break down what reflection in Java is and why frameworks and tools need it, how the Class object — the heart of reflection — works, and the ways to obtain it: via .class, getClass(), and Class.forName(). We’ll discuss when to use reflection and when to avoid it, look at examples of obtaining metadata (name, package, superclass, interfaces), dissect a mini‑utility “What class is it?” and common pitfalls ( ClassNotFoundException, performance, security).
    Open
  • Getting information about classes, fields, and methods

    JAVA 25 SELF
    62 level,1 lecture
    In this lecture we explore reflection in Java: how to use the Class API to obtain details about fields ( getFields()/ getDeclaredFields()), methods ( getMethods()/ getDeclaredMethods()), constructors ( getConstructors()/ getDeclaredConstructors()), and annotations ( getAnnotations()). We’ll learn about modifiers via Modifier ( public, private, protected, static, final), discuss the differences “public vs declared,” build a small class inspector utility, and look at a visual diagram.
    Open
  • Security, limitations, and alternatives to reflection

    JAVA 25 SELF
    62 level,2 lecture
    In this lecture we break down the risks and limitations of reflection: bypassing encapsulation via setAccessible( true), attempts to mutate final fields and why this is dangerous because of JVM optimizations; the fate of SecurityManager and how the module system (Java 9+) leads to InaccessibleObjectException. We will talk about performance and type-safety loss, modern alternatives ( record, sealed, pattern matching, APT, DI) and best practices. At the end — a practical example with the JVM parameter --add-opens.
    Open
  • Creating objects via reflection

    JAVA 25 SELF
    62 level,3 lecture
    How to create objects and manage classes on the fly: why Class.newInstance() is deprecated, how to correctly use getConstructor/ getDeclaredConstructor and Constructor.newInstance, invoke methods via Method.invoke, and read/modify fields via Field. We’ll cover typical exceptions ( ReflectiveOperationException and others), module system limitations, useful practices, and a small utility for dynamic instantiation. Plus — a visual diagram of the whole process.
    Open
  • Reflection and Dependency Injection

    JAVA 25 SELF
    62 level,4 lecture
    In this lecture we examine practical reflection in Java: how to use Class, Field and Method to read private fields ( setAccessible( true)) and build a simple serializer; how DI containers inject dependencies by annotations ( @Inject, @Autowired) through constructors and fields; how dynamic proxies based on Proxy and InvocationHandler intercept calls; where this is used in practice ( Spring, JUnit, Jackson) and what limitations and errors you may encounter.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy