1 J a v a 试题 1) java 程序中,main 方法的格式正确的是()
(选择一项) a)static void main(String[] args) b)public void main(String[] args) c)public static void main(String[]s) d)public static void main(String[] args) 2) 给定java 代码,如下: public byte count(byte b1,byte b2){ return______; } 要使用这段代码能够编译成功,横线处可以填入()
(选择一项) a) (byte) (b1-b2) b) (byte) b1-b2 c) b1-b2 d) (byte) b1/b2 3) 在Java 中,在包com
db 下定义一个类,要让包com
util 下的所有类都可以访问这个类,这个类必须定义为()
(选择一项) a)protected b)private c)public d)friendly 4) 在Java 中,下列()语句不能通过编译
(选择一项) a) String s= “join”+ “was”+ “here”; b) String s= “join”+3; c) int a= 3+5 d) float f=5+5
5; 5) 在Java 中下列()方法可以把JFrame 的布局管理器设为FlowLayout 类型(选择一项) a)jFrame
setLayout(new FlowLayout() ); b) jFrame
addLayout(new FlowLayout() ) c)jFrame
setFlowLayout() d)jFrame
addFlowLayout() 6)给定java 代码如下,运行时,会产生()类