- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
百度广告
Question 2)
public class MyClass {
amethod(arguments);
public void amethod(String arguments) {
System.out.println(arguments[1]);
}
2) error method main not correct
4) amethod must be declared with String
Answer to Question 2
Question 3)
1)
import java.awt.*;
class Myclass {}
package MyPackage;
class MyClass{}
/*This is a comment */
package MyPackage;
class MyClass{}
Answer to Question 3
Question 4)
1) -128 to 127
3) -255 to 256
Answer to Question 4
Question 5)
java myprog good morning
public static void main(String argv)
System.out.println(argv)
}
2) good
4) Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"
Question 6)
1) if
3) goto
5) case
Answer to Question 6
Question 7)
1) 2variable
3) _whatavariable
5) $anothervar
Answer to Question 7
Question 8)
static int i;
System.out.println(i);
}
2) null
4) 0
Answer to Question 8
Question 9)
public class Q {
int anar=new int{1,2,3};
}
1) 1
3) 2
Question 10)
What will happen if you try to compile and run the following code?
public class Q {
int anar=new int;
}
1) Error: anar is referenced before it is initialized
3) 0
Answer to Question 10
Question 11)
What will be the result of attempting to compile and run the following code?
abstract class MineBase {
static int i;
public class Mine extends MineBase {
int ar=new int;
System.out.println(ar[i]);
}
2) Error: ar is used before it is initialized
4) IndexOutOfBoundes Error
Answer to Question 11
Question 12)
int i=1;
case 0:
break;
System.out.println("one");
System.out.println("two");
System.out.println("default");
1) one
3) one, two, default
Answer to Question 12
Question 13)
int i=9;
default:
case 0:
break;
System.out.println("one");
System.out.println("two");
1) default
3) error default clause not defined
Answer to Question 13
Question 14)
1)
int i=0;
System.out.println("Hello");
2)
boolean b=true;
if(b==b2) {
}
int i=1;
if(i==1|| j==2)
4)
int i=1;
if(i==1 &| j==2)
System.out.println("OK");
Question 15)
no file called Hello.txt in the current directory?.
import java.io.*;
public static void main(String argv){
System.out.println(m.amethod());
public int amethod() {
FileInputStream dis=new FileInputStream("Hello.txt");
System.out.println("No such file found");
}catch(IOException ioe) {
System.out.println("Doing finally");
return 0;
}
2 No such file found ,-1
4) 0
Answer to Question 15
Question 16)
1) Methods cannot be overriden to be more private
3) Private methods cannot be overloaded
Answer to Question 16
Question 17)
class Base {}
class Sub2 extends Base {}
public static void main(String argv){
Sub s=(Sub) b;
}
2) Compile time Exception
Question 18)
1) System.out.println( -1 >>> 2);will output a result larger than 10
>> 2); will output a positive number
> 1); will output the number 1
4) System.out.println( 1
责编:罗莉
下一篇:格林模拟试题三参考答案(1)
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>