首页 > 计算机应用技术> 计算机操作系统
题目内容 (请给出正确答案)
[主观题]

下列是一个Java Applet程序,填空使它的功能为计算数组各元素和的平均值。 import java app

let. * ; import java awt. * ; public class Testvv extends Applet { pubfic void paint(Graphics g) { int a[ ]= { 1,3,5,7,9,10 }; double total=0.0,ave=0.0; for(int i=0;i<a.length;i++) total+=a[i]; ave=total/【 】; g.drawstring("ave="+ave,30,60); } }

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“下列是一个Java Applet程序,填空使它的功能为计算数…”相关的问题
第1题
要激活一个Java小程序Applet,需要有()。

A..class文件

B..exe文件

C..html文件

D..java文件

点击查看答案
第2题
下列是一个Java Applet程序,填空使它的功能为计算数组各元素的和。程序执行完后sum 的值应为21.0。
import java.applet.*; import java.awt.*; public class Testxx extends Applet { float [] a=new【 】[6]; float sum=0.0f; public void init() { for(int j=0;j〈a.length;j++)a[j]=j+1; for(int i=0;i〈a.length;i++)sum+=a[i]; } public void paint(Graphics g){ g.drawstring("Total of array elements:="+sum,25,25); } }

点击查看答案
第3题
对于Application,主线程是main()方法执行的线索;对于Applet,主线程是浏览器加载并执行Java小程序。()
对于Application,主线程是main()方法执行的线索;对于Applet,主线程是浏览器加载并执行Java小程序。()

A.正确

B.错误

点击查看答案
第4题
java程序分为两种,分别是______________和applet。

点击查看答案
第5题
Applet程序既可用【 】或浏览器加载执行,也可以利用Java解释器从命令行启动运行。

点击查看答案
第6题
一个Java Applet源程序的主类能有多个父类。()
一个Java Applet源程序的主类能有多个父类。()

A.正确

B.错误

点击查看答案
第7题
从下面提供的答案中选出应填入下列英文语句中______内的正确答案。 The most accurate and most boring way

从下面提供的答案中选出应填入下列英文语句中______内的正确答案。

The most accurate and most boring way to(1)Java is that it is a new computer programming language developed by Sun Microsystems that creates(2)independent programs that can be distributed and run remotely. To run Java programs,a computer must have a Java interpreter. Currently(3)Java programs are small "applets" that are(3)as part of web pages.

When you use a Java(4)browser to view a Web page that includes a Java applet, the browser loads the applet onto your computer through your modem or network. Then the Java interpreter runs the applet, which could include animation or sound, on your computer rather than transmitting the code bit by bit over Internet. Afew thousand bytes of Java code can turn into a powerful program on your computer.

So an applet could include(5)with Java interpreter.

点击查看答案
第8题
下列Applet在窗口中实现一个不可编辑的TextField,并且显示“ok”。请填写正确的程序在横线处。 i
mport java.applet.Applet; import java.awt.*; public class Test14 extends Applet { TextFiled tf; public void init() { setLayout(new GridLayout(1,0)); tf=new TextField("Ok"); 【 】 add(tf); } }

点击查看答案
第9题
Java语言中,()是所有类的根类。

A.Thread

B.Root

C.Object

D.Applet

点击查看答案
第10题
下列关于JAVA语言中要使用的一个变量,正确的是()。

A.在JAVA程序中要使用一个变量,必须先对其进行声明

B.变量声明语句可以在程序的任何地方,只要在变量使用前就可以

C.变量不可以在其作用域之外使用

D.局部变量在使用之前可以不初始化,系统使用默认的初始值

点击查看答案
第11题
下列程序实现的功能是当按下键盘时,在Applet中通过paint()方法,在(50,50)位置处显示出按下的键的

下列程序实现的功能是当按下键盘时,在Applet中通过paint()方法,在(50,50)位置处显示出按下的键的名称。在横线处填写正确的语句。 import java.awt.*; import java.awt.event.*; import java.applet.*; public class Test7 extends Applet { String str=""; public void init() { addKeyListener (new KeyAdapter() { public void keyPressed(KeyEvent ke) { 【 】; repaint(); } }); requestFocus(); } public void paint(Graphics g) { g.drawString("你按下的键是:" +str, 50,50); } }

点击查看答案
退出 登录/注册
发送账号至手机
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改