相关题目
以下哪条语句可以查询10号部门中工种为Manger 和20号部门中 工种为clerk 的员工信息
新建一个输入输出正确象,下面哪个选项的代码是错误误的
getCustomerInfo()方法如下,try中可以捕获三种类型的异常,如果在该方法运行中产生了一个IOException,将会输出什么结果()
public void getCustomerInfo() {
try {
// do something that may cause an Exception
} catch (java.io.FileNotFoundException ex) {
System.out.print("FileNotFoundException!");
} catch (java.io.IOException ex) {
System.out.print("IOException!");
} catch (java.lang.Exception ex) {
System.out.print("Exception!");
}
}
阅读Shape和Circle两个类的定义。在序列化一个Circle的正确象circle到文件时,下面哪个字段会被保存到文件中? ( )
class Shape {
public String name;
}
class Circle extends Shape implements Serializable{
private float radius;
transient int color;
public static String type = "Circle";
}
在以下代码中,哪项会编译报错误?
interface IFace{}
class CFace implements IFace{}
class Base{}
public class ObRef extends Base{
public static void main(String argv[]){
ObRef ob = new ObRef();
Base b = new Base();
Object o1 = new Object();
IFace o2 = new CFace();
}
}
给出如下声明:
String s = “Example”;
合法的代码有哪些
程序运行到第5行时,j的值为多少
1. public class test (
2. public static void main (String args[]) {
3. int i = 0xFFFFFFF1;
4. int j = ~i;
5.
6. }
7. )
在下面程序的第6行补充上下列哪个方法,会导致在编译过程中发生错误误
1) class Super{
2) public float getNum(){
3) return 3.0f;
4) }
}
5) public class Sub extends Super{
6)
7) }
下面代码的执行结果是
import java.util.*;
public class ShortSet{
public static void main(String args[])
{
Set
for(Short i=0;i<100;i++)
{
s.add(i);
s.remove(i-1);
}
System.out.println(s.size());
}
}
编译运行以下程序后,关于输出结果的说明正确的是
public class Conditional{
public static void main(String args[ ]){
int x=4;
System.out.println(“value is “+ ((x>4) ? 99.9 :9));
}
}
