本文主要通过3个例子论述了final修饰基本类型变量及引用变量时的差异,特别是final修饰引用变量时要注意的安全问题,否则容易被黑客利用。最后从前面的例子及博客中讨论Java中String被设计成不可变类的深层次原因...
分类:
编程语言 时间:
2014-05-26 04:59:16
阅读次数:
347
'''
【程序71】
题目:编写input()和output()函数输入,输出5个学生的数据记录。
1.程序分析:
2.程序源代码:
使用list来模拟结构(不使用class)
stu = [string,string,list]
'''
N = 3
#stu
# num : string
# name : string
# score[4]: list
student =...
分类:
编程语言 时间:
2014-05-26 04:11:00
阅读次数:
440
假定每个单词用空格隔开。
例子:
输入:how are you!
输出:3
两种方法:
一:
#include
#include
#define SIZE 20
int main()
{
char str[SIZE]={'\0'};
int count=0;
printf("please input the string\n");
gets(str);
put...
分类:
编程语言 时间:
2014-05-26 03:44:36
阅读次数:
284
原来的string docvalues使用utf-8编码,加载时转码花费大量时间,我们把转码实现从new String(bytes, "UTF-8")改用lucene的bytesRef.utf8ToString,减少了大约十秒的时间。
想进一步优化,我们使用UTF-16LE编码,解码非常简单甚至只需拷贝,如果用简单的byte[]到char[]转换,可以在节省7秒时间,而如果用unsafe可以节省...
分类:
其他好文 时间:
2014-05-25 01:46:44
阅读次数:
246
首先,在之前,我不是一个 Python玩家,我只是一个使用者,需要即取,现在,我要认真学习和记录,正确称为一个Python的玩家。
说明,这明显不是教程,是我自己理解并记录的笔记而已。
Python有五个标准的数据类型:
Numbers(数字)String(字符串)List(列表)Tuple(元组)Dictionary(字典)
数字有四种数值类型:int,long ,float...
分类:
编程语言 时间:
2014-05-24 23:07:59
阅读次数:
387
Given a string S and a string T, find the
minimum window in S which will contain all the characters in T in complexity
O(n).For example, S = "ADOBECOD...
public Image GetImage(string path) { FileStream fs
= new FileStream(path, FileMode.Open, FileAccess.Read); Image ...
分类:
其他好文 时间:
2014-05-24 09:48:26
阅读次数:
233
private void button1_Click(object sender, EventArgs
e) { IList arrayAnimal = new ArrayList(); arrayAnimal.Add("12");
arrayAnimal.Add("df"); arrayA...
分类:
其他好文 时间:
2014-05-24 09:37:46
阅读次数:
211
分为有参数和无参数,还有THIS的使用方法,可用于传递给类,也可用于调用其它构造方法。public class Book { private String
name; public Book(){ this("this调用有参数的构造方法"); System....
分类:
编程语言 时间:
2014-05-24 09:33:45
阅读次数:
330
private boolean tabbleIsExist(String tableName,
SQLiteDatabase db) { LogUtils.d("DatabaseHelper", "checking tabbleIsExist " +
tableName); ...
分类:
移动开发 时间:
2014-05-24 09:32:40
阅读次数:
206