1、什么是自动装箱基本数据类型的自动装箱(autoboxing)、拆箱(unboxing)是自J2SE 5.0开始提供的功能。一般我们要创建一个类的对象的时候,我们会这样:Class a = new Class(parameter);当我们创建一个Integer对象时,却可以这样:Integer i...
分类:
编程语言 时间:
2014-06-18 09:35:58
阅读次数:
244
1. 提供对应的构造方法
//构造器注入
public class Bean6 {
private String name;
private Integer age;
// 服务于构造器注入使用
public Bean6(String name, Integer age) {
super();
this.name = name;
this.age = age;
...
分类:
编程语言 时间:
2014-06-18 06:15:08
阅读次数:
199
1. 提供对应要注入的属性
//setter注入
public class Bean2 {
private String name;
private Integer age;
// 提供要注入的属性对应的setter方法
public void setName(String name) {
this.name = name;
}
public void setAge(I...
分类:
其他好文 时间:
2014-06-18 06:14:27
阅读次数:
209
首先简单介绍一下罗马数字,一下摘自维基百科罗马数字共有7个,即I(1)、V(5)、X(10)、L(50)、C(100)、D(500)和M(1000)。按照下述的规则可以表示任意正整数。需要注意的是罗马数字中没有“0”,与进位制无关。一般认为罗马数字只用来记数,而不作演算。重复数次:一个罗马数字重复几...
分类:
其他好文 时间:
2014-06-18 00:02:25
阅读次数:
311
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to
m + n) to
hold additional ele...
分类:
其他好文 时间:
2014-06-17 23:05:13
阅读次数:
246
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this?Here are some good questions to ...
分类:
其他好文 时间:
2014-06-17 20:06:14
阅读次数:
205
题目
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
方法
public int romanToInt(String s) {
HashMap hm = new H...
分类:
其他好文 时间:
2014-06-17 19:27:48
阅读次数:
324
题目
Given an integer, convert it to a roman numeral.
Input is guaranteed to be within the range from 1 to 3999.
方法
/*语法:
*(1)基本数字I,X,C中的任何一个连用构成数目,都不能超过三个;
* 放在大数的左边只能用一个。
(2)基...
分类:
其他好文 时间:
2014-06-17 16:33:27
阅读次数:
217
题目
Determine whether an integer is a palindrome. Do this without extra space.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to ...
分类:
其他好文 时间:
2014-06-17 16:12:39
阅读次数:
226
有3个:floor — 舍去法取整 floor ($value )返回不大于 value 的下一个整数,将 value 的小数部分舍去取整。floor() 返回的类型仍然是 float,因为 float 值的范围通常比 integer 要大。 ceil — 进一法取整ceil ( $value )....
分类:
Web程序 时间:
2014-06-17 15:08:58
阅读次数:
234