Java软件工程企业测评测试题,中智人才测评测试题,人才测评测试题,java基础测试题,java测试题,java基础测试题及答案,java面向对象测试题,java基础知识测试题,java逻辑思维测试题,黑马java基础班测试题
Java软件工程师企业测评测试题
一、选择题:(每题2分)
1.名为HelloWorld.java的Java应用程序如下: (B)
public class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
将这个程序放在C:\Test下,然后在命令行窗口中,进入到C:\Test路径执行如下指令:
javac helloworld.java将得到什么结果?
编译成功,生成名为HelloWorld.class的文件。
helloworld.class的文件。
helloworld.java的文件。
2.下面的程序名为Student.java:B
public class Student
{
private String name;
public Student(String s_name) //1
{
name = s_name; //2
}
public static void main(String args[])
{
Student s = new Student(); //3
}
}
使用如下指令编译:javac Student.java。将会得到什么结果?
Student.class的类文件。
//3处出错。
//2处出错。
编译时在//1处出错。
3.关于下面的类描述中正确的是:C
class Test { // 1
void test(int i) { // 2
System.out.println("I am an int."); // 3
} // 4
void test(String s) { // 5
System.out.println("I am a string."); // 6
} // 7
// 8
public static void main(String args[]) { // 9
Test t=new Test(); // 10
char ch='y'; // 11
t.test(ch); // 12
} // 13
} // 14
编译出错
编译通过,运行出错
编译通过,运行时输出“I am an int” ????
编译通过,运行时输出“I am a string”
4.关于下述程序:C
public class Test3
{
public static void main(String[] agrs)
{
byte b = 2,e =3; //1
byte f = b+e; //2
System.out.println(f); //3
}
}
描述正确的是?
编译通过,运行时打印出5。
23。
//2处有错误,因为此处f必须是一个int类型的变量。
编译不通过,在//1处有错误,不能这样定义变量
public class Divide
{
public static void main(String args[])
{
System.out.println("17.0/0 = "+17.0/3); //1
System.out.println("17/0 = "+17/3); //2
}
}
描述正确的是? 编译通过,运行17.0/0=5.66666666666666? 17/0=5
编译出错
编译通过,运行时//1、//2处均出现异常
//1处得到一个