JAVA learning lesson 64th-reflection mechanism
The Java reflection mechanism is in the running state. For any class, all attributes and methods of this class can be known,Any method and attribute of an object can be called. This dynamically obtained
Problem:
Can I know the attributes and methods of a Java class at runtime? Can I call any of its methods?
The answer is yes. Java provides a reflection mechanism for implementation.
Directory
What is the reflection mechanism of Java?
The Java reflection mechanism is in the running state. For any class, all attributes and methods of the class can be obtained. For any object, any method of the class can be called; this kind of dynamically obtained information and the function of
Java database connection (JDBC) is composed of a group of classes and interfaces written in Java programming language. JDBC provides a standard API for tools/database developers to write database applications using pure Java APIs. However, the
Java database connection (JDBC) is composed of a group of classes and interfaces written in Java programming language. JDBC provides a standard API for tools/database developers to write database applications using pure Java APIs. However, the
Java database connection (JDBC) is composed of a group of Java
Programming Language The composition of the written classes and interfaces. JDBC provides a standard API for tools/database developers to write database applications using pure Java
Java connection to various databases1. oracle8/8i/9i Database (thin Mode)Class. forname ("oracle. JDBC. Driver. oracledriver"). newinstance ();String url = "JDBC: oracle: thin :@ localhost: 1521: orcl ";// Orcl is the SID of the databaseString user =
1. Why reflection:If an external Object is received when the program runs, the compilation type of the Object is Object, but the program needs to call the method of the Object running type:(1). If the compilation and running types are all known, use
In this articleCodeLists key code used to connect to a database. Other database access code is omitted.
The code in this article mainly lists the key code used to connect
We know that the reflection mechanism is widely used in spring, so where is it actually used?
A major core concept of spring is injection,
However, one premise of this is that the class is managed by spring.
Reflection generates a specific instance
Various database connection URL key codesSCS (Chengdu) Technology company Yu Chipeng cfanboy@163.com 14-aug-2005When connecting to the database through JDBC, each database has a different URL format, for the convenience of everyone, I provide the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.