我该如何解决这个问题OutOfBoundsException?
这是我正在使用的代码:
ResultSet rsTagCheck = stmt.executeQuery(
"SELECT PARKING.XKRPRMT.XKRPRMT_PIDM, PARKING.XKRPRMT.XKRPRMT_STATUS, PARKING.XKRPRMT.XKRPRMT_EXPIRE_YR, PARKING.XKRPRMT.XKRPRMT_TAG FROM PARKING.XKRPRMT WHERE XKRPRMT_PIDM ='" + BannerID + "'");
while (rsTagCheck.next()){
String TagNum = rsTagCheck.getString("XKRPRMT_TAG");
ArrayList<String> myTag = new ArrayList<String>();
for (int i = 0; i < TagNum.length(); i++){
myTag.add(TagNum);
myTag.get(i + i);
Run Code Online (Sandbox Code Playgroud)
我知道为什么我会收到错误,但我不知道如何解决问题.
好的说我有一个函数可以在自定义LinkedList类中查找特定的单词:
public LinkedList find(String word) {
if (this.word.equals(word))
return this;
if (next==null)
return null;
if (next.find(word)==next)
return next;
return null;
}
Run Code Online (Sandbox Code Playgroud)
此代码工作正常,但它返回匹配条件的FIRST找到的对象.如果我想返回与参数匹配的LAST对象怎么办?我很难搞清楚这一点.请记住我想使用递归.
编辑:这段代码会出现什么问题:
public LinkedList findLast(String word) {
LinkedList temp=new LinkedList(word, null);
if (next==null && next.word.equals(word))
return next;
if (next==null && !next.word.equals(word))
temp=next.findLast(word);
return temp;
}
Run Code Online (Sandbox Code Playgroud) 我在堆栈上分配12个字符串,或者相当于它是12个字节.
使用gdb(在Linux下)进行分解表明,为了在堆栈上为字符串分配空间,esp会被-24(向下移动)移动.
push %ebp
mov %esp,%ebp
sub $0x18,%esp
Run Code Online (Sandbox Code Playgroud)
为什么它移动了24(0x18)?
问候!解析谷歌搜索结果的最常用方法是什么,并将其转为:
{
"results": [
{
"region": "IL",
"streetAddress": "1611 South Randall Road",
"titleNoFormatting": "Brunswick Zone XL Randall Road",
"staticMapUrl": "http://maps.google.com/maps/api/staticmap?maptype=roadmap&format=gif&sensor=false&size=150x100&zoom=13&markers=42.162958,-88.334155",
"listingType": "local",
"addressLines": [
"1611 South Randall Road",
"Algonquin, IL"
],
"lng": "-88.334155",
"phoneNumbers": [
{
"type": "",
"number": "(847) 658-2257"
}
],
"url": "http://www.google.com/maps/place?source=uds&q=brunswick+zone&cid=8286591317090502839",
"country": "United States",
"city": "Algonquin",
"content": "",
"GsearchResultClass": "GlocalSearch",
"maxAge": 604800,
"title": "Brunswick Zone XL Randall"
},
...
]
}
进入这个:
Name="Brunswick Zone XL Randall Road" Address="1611 South Randall Road" Phone="(847) 658-2257"
int main(int argc, char **argv) {
char username[256];
username = ?;
}
Run Code Online (Sandbox Code Playgroud)
谢谢〜
我有HashMap对象包含一个x-y-z具有相应值的键test-test1-test2.
Map<String,String> map = new HashMap<String,String>();
map.put("x-y-z","test-test1-test2");
map.put("x1-y1-z1","test-test2-test3");
Run Code Online (Sandbox Code Playgroud)
现在我有一个输入字符串数组,其中包含一些键:
String[] rem={"x","x1"}
Run Code Online (Sandbox Code Playgroud)
基于这个字符串数组,我想删除HashMap值.
任何人都可以提供有效的方法来执行此操作吗?
Java中用于分割字符串的正则表达式是什么:(
[space]0[space]空格后跟零后跟空格)?
例如
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5
Run Code Online (Sandbox Code Playgroud)
分裂为:
123456789101112131415
Run Code Online (Sandbox Code Playgroud)
和
12345
Run Code Online (Sandbox Code Playgroud) 有没有办法创建这样的年龄选择列表:
<?php
$Array = array('99','98','97','96');
?>
<select name="age">
<option value="" selected>Choose</option>
<?php foreach($Array as $value){ echo('<option value="' . $value . '">' . $value . '</option>');}?>
</select>
Run Code Online (Sandbox Code Playgroud)
但是没有一个非常长的阵列,因为我希望年龄范围从18到100,这需要永远写出来吗?
我有一个字符串: Bruce A Johnson
我想要它Bruce Johnson.
如何A使用PHP从字符串中删除单个?(只需删除1个字符的所有"单词")
我是Java编程的初学者,想了解在这里处理多态引用的正确方法.
假设我们在C++中有以下(抽象)代码:
List<Fruit*> lstFruit;
...
// collect apples here
while (...)
{
Fruit* apple = new Apple("green");
lstFruits.append(apple);
}
...
lstFruit[i]->doSomething(); // here is our virtual method
Run Code Online (Sandbox Code Playgroud)
Java不允许我创建一个List包含对基类的引用的集合abstract.在这种情况下我该怎么办?我的目标是普遍使用不同的子类对象,无论他们的班级是什么.
java ×6
c ×2
php ×2
regex ×2
android ×1
arraylist ×1
arrays ×1
assembly ×1
collections ×1
hashmap ×1
linked-list ×1
parsing ×1
polymorphism ×1
recursion ×1
string ×1