问答题
下面的代码实现一个简单的Applet:
import java.applet.Applet;
import java.awt.*;
public class Sample extends Applet
private String text="Hello World";
public void init()
add(new Label(text));
public Sample(String string)
text=string;
通过下面的HTML文件访问:
<html>
<title>Sample Applet</title>
<body>
<applet code="Sample.class"width=200 height=200></applet>
</body>
</html>
当编译和运行该小程序时会出现什么结果,请选择正确的答案。( )
【参考答案】
D
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下面的代码中方法unsafe()有异常发生,那么可以加在第一行的语句为( )。 if(unsafe()) do something else if(safe()) do the other Ⅰ:public void methodName() Ⅱ:public void methodName() throw IOException Ⅲ:public void methodName() throws IOException Ⅳ:public void methodName() throws Exception
A.Ⅲ、Ⅳ
B.Ⅱ、Ⅲ、Ⅳ
C.Ⅰ、Ⅲ
D.Ⅰ、Ⅳ
点击查看答案&解析
单项选择题
下列代码段的执行结果是( )。 public class Test public static void main(String args[]) String s1=new String( hello ); String s2=new String hello ); System.out.println(s1==s2); System.out.println(s1.equal(s2));
A.true false
B.true true
C.false true
D.false false
点击查看答案&解析
相关试题
Java源程序是由类定义组成的,每个程序中可...
下列Applet在窗口中实现一个不可编辑的Text...
赋值表达式的组成是:在赋值运算符的左边是...
每个Applet必须定义为 【13】 的子类。
阅读下面程序段,SelectItem应用程序显示从...