我有以下示例:
import java.util.EnumSet;
import java.util.Iterator;
public class SizeSet {
public static void main(String[] args) {
EnumSet largeSize = EnumSet.of(Size.XL,Size.XXL,Size.XXXL);
for(Iterator it = largeSize.iterator();it.hasNext();){
Size size = (Size)it.next();
System.out.println(size);
}
}
}
enum Size {
S, M, L, XL, XXL, XXXL;
}
Run Code Online (Sandbox Code Playgroud)
在这段代码中,我可以理解Enum创建了一个Enum类型的大小.
我的问题是:是largeSizeEnumSet类型的对象吗?它到底意味着什么?我真的想更好地理解它.
以下内容来自求职面试:
在包含整数的给定数组中,除了一个数字之外,每个数字重复一次,不重复.编写一个函数,查找不重复的数字.
我想过使用HashSet,但它可能会使一切变得复杂......
任何简单解决方案的想法?
我无法理解以下atoi实现代码,特别是这一行: atof
代码:
k = (k << 3) + (k << 1) + (*p) - '0';
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释一下吗?
另一个问题:atoi实施算法应该是什么?
在我的一次采访中,我在一个'新的'原始集合中遇到了一个非常复杂的问题(当他们告诉我他们基于Python的QA测试时,为什么地狱QA需要汇编知识?),这就是这样的:
假设您的汇编语言仅包含以下说明:
'inc REG':将给定寄存器递增1.'dec REG':将给定的寄存器减1.'jnz LABEL':如果前一条指令的结果不为零,则跳转到给定的LABEL.'HELT':停止运行.任务:A和B寄存器保持非负值.程序应计算A*B的值并将结果定位在C.此外,语言包含寄存器C,D,...,Z,您可以假设它们在程序开始时被初始化为零.
这里有几点需要更多关注,比如你必须事先考虑A和\或B值可能为零..并且多个零是......零...这真是该死的...
PS因为这个问题我没有达到'my_atoi()'问题的实现.. :-(
谢谢 !
我试过这个:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
map:mapType="normal"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
但我得到了2个错误:
<fragment xmlns:map="http://schemas.android.com/apk/res-auto": 为标记片段找到了意外的名称空间前缀"xmlns"
2 . map:mapType="normal":
为标记片段找到了意外的名称空间前缀"map"
我做错了什么,为了在我的应用程序中集成除谷歌地图之外的更多对象,应该怎么样?
thnx!
编辑!!
我试过这个,它有效!
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
map:mapType="normal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
无法理解为什么..也无法理解什么map:mapType="normal"和xmlns:map="http://schemas.android.com/apk/res-auto"意味着什么......?
我建了一个选项菜单.其中一个处理发送电子邮件的按钮无效.
以下是方法:
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main_page, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.settings: Toast.makeText(this, "You pressed the settings!", Toast.LENGTH_LONG).show();
break;
case R.id.exit: System.exit(0); //close the program + kill it from memory
break;
case R.id.contactUs:sendEmail();
break;
}
return true;
}
private void sendEmail(){
Intent mailIntent = new Intent();
mailIntent.setAction(Intent.ACTION_SEND);
mailIntent.setType("text/plain");
mailIntent.putExtra(mailIntent.EXTRA_EMAIL, new String[]{"some_email@gmail.com"});
mailIntent.putExtra(mailIntent.EXTRA_SUBJECT,"Re:Your Application");
}
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我点击的任何项目(contactUs项目除外)都在工作.当我点击contactUs项目时,它会关闭菜单栏并且什么都不做......
需要帮忙.
编辑:
我改变了以下内容:
private void sendEmail(){
Intent mailIntent = new Intent();
mailIntent.setAction(Intent.ACTION_SEND);
mailIntent.setType("text/plain");
mailIntent.putExtra(Intent.EXTRA_EMAIL, new …Run Code Online (Sandbox Code Playgroud)