计应134(实验班) 周露玲通过Computer类和USB类之间产生的紧密耦合关系来实现依赖注入。创建一个USB类public interface USB //USB接口{ public void insert();//插入 public String read();//读取 pu...
分类:
编程语言 时间:
2015-06-08 19:20:04
阅读次数:
157
1 // short start = (short) 0xB0A0; 2 short start = (short) 0xA1A0; 3 // gbk gb2312 big5 gb18030 4 String encoder = "gb...
分类:
其他好文 时间:
2015-06-08 19:13:24
阅读次数:
206
通过java获取计算机名String hostname = "Unknown"; try { InetAddress addr; addr = InetAddress.getLocalHost(); hostname = addr.getHostName(); }...
分类:
编程语言 时间:
2015-06-08 19:08:34
阅读次数:
130
为其他对象提供一种代理以控制对这个对象的访问。下面的列子是学校代理追求女孩送礼物的是过程:一、女孩 1 /// 2 /// 被追求 3 /// 4 public class SchoolGirl 5 { 6 private string n...
分类:
其他好文 时间:
2015-06-08 19:07:48
阅读次数:
101
string str="aaa[##]ccc[##]ddd[##]bb"Regex regex=new Regex(str);//以 [##] 分割 string[] result=regex.Split(s);
String:字符串常量StringBuffer:字符串变量StringBuilder:字符串变量对于这句话的理解你可能会产生这样一个疑问 ,比如这段代码: 1Strings="abcd";2s=s+1;3System.out.print(s); //abcd1我们明明就是改变了String型的变量...
分类:
其他好文 时间:
2015-06-08 18:51:56
阅读次数:
176
PHP POST 数据 $data = array("name" => "Hagrid", "age" => "36"); $data_string = json_encode($data); $ch = curl_init(‘http://api.local/rest/users‘); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); ...
分类:
Web程序 时间:
2015-06-08 17:38:59
阅读次数:
134
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “...
分类:
其他好文 时间:
2015-06-08 17:32:43
阅读次数:
136
有时候,类和方法需要对类型变量加以约束,比如你有一个方法,你只希望它接收某个特定类型及其子类型作为参数。
下面就举一个方法限定接收参数的类型的例子来说明如何限定类型变量。
首先有几个简单的辅助类:
package generic;
public class Person extends Animal {
private String name;
public Person(Strin...
分类:
编程语言 时间:
2015-06-08 17:28:14
阅读次数:
189
L58: Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘,
return the length of last word in the string.
If the last word does not exist, retur...
分类:
其他好文 时间:
2015-06-08 17:27:49
阅读次数:
145