我只是在研究OCPJP问题,我发现了这个奇怪的代码:
public static void main(String a[]) {
System.out.println(Double.NaN==Double.NaN);
System.out.println(Double.NaN!=Double.NaN);
}
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,我得到了:
false
true
Run Code Online (Sandbox Code Playgroud)
false当我们比较两个看起来彼此相同的东西时,输出结果如何?什么NaN意思?
我正在EditText使用setvisibility(View.INVISIBLE)和更改从隐形到可见的可见性setvisibility(View.VISIBLE).但我也想知道是否有任何方法在android中提供检查EditText的可见性,即EditText是可见的还是任何类型的.
提前致谢.
我想更新一行,如果它存在于表中,否则在单个查询中将其插入SQLite中.从SQLite文档中我发现我们可以使用REPLACE命令来实现这一目标.
REPLACE如果有两个或更多条件,我想知道如何使用:
示例:
如果我有TABLE1包含以下记录的表:
Name Type InitialValue FinalValue
A 1 20 40
B 2 23 50
A 3 40 60
C 3 54 70
Run Code Online (Sandbox Code Playgroud)
这里的组合Name和Type将是独一无二的.
我想设置initialvalue = 50并finalvalue = 90 在那里name = A和Type = 3 如果它存在,否则将其插入.
我正在使用此命令,但它给出了此错误:
REPLACE INTO table1(Name,Type,InitialValue,FinalValue)VALUES('A',3,50,90)WHERE Name ='A'AND Type = 3;
错误是:
"WHERE"附近:语法错误无法执行语句
我怎样才能实现目标?请帮忙.
您好我使用此站点的以下代码:http://java.sun.com/developer/technicalArticles/ALT/Reflection/
但是,当我运行它时,它显示异常java.lang.ClassNotFoundException:A 可能是我错了地方请帮忙.这是代码:
package com.Test;
class A {}
public class instance1 {
public static void main(String args[])
{
try {
Class cls = Class.forName("A");
System.out.println("gfsdga");
boolean b1
= cls.isInstance(new Integer(37));
System.out.println(b1);
boolean b2 = cls.isInstance(new A());
System.out.println(b2);
}
catch (Throwable e) {
System.err.println(e);
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用antroid:TextView的autoLink ="map"属性转到地图并找到与该textview相关联的地址.
但它表现得很凶悍,只能找到一些地址.这是我正在尝试的代码:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewautoLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/autolinktext"
android:autoLink="map"></TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的strings.xml
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="autolinktext">1600 Amphitheatre Parkway, Mountain View, CA 94043 </string>
</resources>
Run Code Online (Sandbox Code Playgroud)
问题是:
假设我正在编写上面的字符串,即 1600 Amphitheatre Parkway,Mountain View,CA 94043, 那么它的工作正常,textView变为蓝色,当我点击它时,它会搜索地图上的地址.
当我将此地址更改为:1600 Amphitheatre Parkway,Mumbai,IN时, 它也显示相同的内容并尝试搜索地址,但由于地址错误,它无法找到它.没关系.
但当我写其他地址时:600 Band Stand,Mumbai,IN Then
1)textview不是蓝色
2)它似乎不可点击
3)由于它不可点击,因此找不到地址.
我正在搜索谷歌,但我没有得到任何理由这种行为.我也想知道
有没有写这个地图地址的格式?
另外android如何通过在String中写入地址来知道地址是否有效,因为我已经以相同的格式写了相同的地址只更改了字符串,结果是一个地址是可点击的而其他地址不是.
请帮忙.