构造方法数据类型的测试
来源:互联网 发布:pb神经网络算法 编辑:程序博客网 时间:2024/06/07 06:30
9.1 新建一个Demo1的实体类
package com.eduask.entity2;
//新建一个Demo1的实体类;
public class Demo1 {
private int id;
private String name;
private String pwd;
public Demo1() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
@Override
public String toString() {
return "Demo1 [id=" + id + ", name=" + name + ", pwd=" + pwd + "]";
}
public Demo1(int id, String name, String pwd) {
super();
this.id = id;
this.name = name;
this.pwd = pwd;
}
}
9.2 新建一个TestDemo1的测试类
package com.eduask.entity2;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestDemo1 {
public static void main(String[] args) {
ClassPathXmlApplicationContext cx=new ClassPathXmlApplicationContext("entity2Xml/demo1.xml");
Demo1 demo1=(Demo1) cx.getBean("Demo1");
System.out.println("构造方法类型的测试");
System.out.println(demo1);
}
}
9.3新建一个Demo1.xml的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"
>
<bean id="Demo1" class="com.eduask.entity2.Demo1">
<constructor-arg name="id" value="001" index="0" type="int"/>
<constructor-arg name="name" value="tom" index="1" type="String"/>
<constructor-arg name="pwd" value="123456" index="2" type="String"/>
</bean>
</beans>
9.4程序运行如下:
构造方法类型的测试
Demo1 [id=1, name=tom, pwd=123456]
- 构造方法数据类型的测试
- OC_构造方法,自定义构造方法,分类,类的深入研究,description,SEL数据类型笔记
- Java构造方法&数据类型(5.21)
- 数据类型的一些测试
- 一个测试程序看懂静态代码块、构造代码块以及构造方法的执行顺序
- C语言中构造数据类型的初始化
- C++ 调用内置数据类型的构造函数
- 关于数据类型的简单测试
- 测试CXF支持的数据类型
- 数据类型转换的方法
- 数据类型的方法
- 数据类型转换的方法
- BOM的构造方法
- 构造方法的特点
- Java的构造方法
- 构造方法的继承
- 继承的构造方法
- java的构造方法
- POJ 2378 Tree Cutting (简单树形DP、删点)
- iOS开发Webview,加载html代码图片适配
- Mysql 相邻两行记录某列的差值
- 判断输入是否包含汉字或其他字母
- python,.Net,Java的垃圾回收机制
- 构造方法数据类型的测试
- android实现抓取网络访问数据的方式(一)
- Codeforces Round #336 (Div. 2)-C. Chain Reaction
- 【数据结构】数据结构中常用的排序算法
- [bzoj1088][DP]扫雷Mine
- Qt 字幕滚动程序
- 栈--未接触者可进0.0
- Java_集合—Set
- TOJ 1391.Hay Points