1. 一个字符界面的Java Application 程序,程序名为TestX.java,实现以下功能:
1) 能接受用户调用该程序时的一个正整数参数(如:执行时使用java TestX 100);
2) 计算出小于该数的所有素数(即:只能被1和它自身整除的数),并打印在屏幕上。
1.尝试写一个Applet,并使其在界面中位置(100,100)处开始打印红色的字符串“你好”。3.已知有一名为TeaTest.class的Applet文件存放在http://www.sut.edu.cn/tea位置上,请写一个简单HTML文件,实现对该Applet的加载。2. 一个字符界面的Java Application 程序,程序名为TestX.java,实现以下功能:
1) 能接受用户调用该程序时的一个正整数参数(如:执行时使用java TestX 100);
2) 计算出小于该数的所有素数(即:只能被1和它自身整除的数),并打印在屏幕上。
3. 请写出一个主类,打印出所有水仙花数,水仙花数是指3位数的各位数值的立方和等于其本身,其中,在java.lang.Math 中有pow(int x,int y)方法可求出x的y次幂。
三、阅读程序,写出结果
import java.io.*;
public class Class1 {
public static void main( String args[] )
{ int i=args.length();
For(int j=0;j<i;j++)
System.out.println( args[i]);
}
}
上面程序经过编译后,在DOS提示符输入:
java Class1 I am a Student
则该程序打印的结果是
2.阅读程序, 在画线处写出该程序完成的功能
class Xyz implements Runnable
{ long s=0,n;
public void run()
{
for(int i=1;i<=n;i++)
s+=i;
}
}
public class ThreadTest {
public static void main(String args[])
{
Xyz r = new Xyz();
r.n=1000000;
Thread t1 = new Thread(r);
Thread t2 = new Thread(r);
t1.start();
t2.start();
}
}
该程序实现的功能:
3.阅读程序,在画线处写出该程序的结果:
import java.io.* ;
public class Test
{ public static void main(String args[ ])
{ int x=10,y=20,z=30;
x=x>y?x:y;
x=x>z?x:z;
System.out.println("Maxint="+x);
}
}
该程序运行结果是
4.阅读程序,在画线处写出该程序的结果:
import java.io.* ;
public class Test
{ public static void main(String args[ ])
{
SubClass S=new SubClass(210,220,230);
System.out.println("a="+S.a+ "; b="+ S.b+"; c= "+S.c);
}
}
class SubClass
{ int a,b,c;
SubClass(int aa,int bb,int cc)
{ a=aa; b=bb; c=cc;
}
}
该程序运行结果是
5.阅读程序,在画线处写出该程序完成的功能
import java.awt.*;
public class abc
{ public static void main(String args[])
{ Frame f=new Frame();
Label L = new Label("祝考试成功");
f.add(L);
f.setSize(400,500);
f.show();
}
}
该程序实现了
1.阅读程序,在画线处写出该程序的功能;
import java.awt.*;
import java.applet.Applet;
public class Applet1 extends Applet
{
public void paint( Graphics g )
{
g.setColor(Color.red);
g.drawString( "This is TestColor!" , 30,150 );
}
}
该程序
3.阅读程序
import java.awt.*;
import java.applet.*;
public class Test_FillCircle extends Applet {
public void paint(Graphics g) {
g.setFont(new Font(“宋体”,Font.NORMAL,24))
g.setColor(Color.blue);
g.drawString("This is draw a circle",100,100);
g.setColor(Color.RED);
g.fillArc(100, 100, 200,200,0,360);
} }
该方法主要完成
2.阅读程序,在画线处写出该程序的结果:
import java.io.* ;
public class Test
{ public static void main(String args[ ])
{
SubClass S=new SubClass(210,220,230);
System.out.println("a="+S.a+ "; b="+ S.b+"; c= "+S.c); }
}
class SuperClass
{ int a,b;
SuperClass(int aa , int bb)
{ a=aa; b=bb; }
}
class SubClass extends SuperClass
{ int c;
SubClass(int aa,int bb,int cc)
{ super(aa,bb);
c=cc;
}
}
4.阅读程序, 在画线处写出该程序完成的功能
class Xyz implements Runnable
{ int i,s=0;
public Xyz(int i){ this.i=i; }
public void run() {
while (i>0) { s*=i; i--; }
System.out.println(s);
}
}
public class ThreadTest {
public static void main(String args[]) {
Xyz r1 = new Xyz(100);
Xyz r2 = new Xyz(66);
Thread t1 = new Thread(r1);
Thread t2 = new Thread(r2);
t1.start();
t2.start();
}
}
该程序
1.阅读程序,为画线语句加注释;
import java.awt.*;
import java.applet.Applet;
public class DrawMyImage extends Applet
{
Image myImage;
public void init( ){
myImage = getImage(getDocumentBase( ),"pica.jpg"); //
}
public void paint(Graphics g){
g.drawImage(myImage,0,0,this); //
}
}
2.阅读程序,在画线处写出该程序完成的功能
import java.awt.*;
public class abc
{ public static void main(String args[])
{ FrameOut f=new FrameOut();
}
}
class FrameOut extends Frame
{ public FrameOut( )
{ super("提交对话窗体");
Button btn = new Button("确定");
add(btn);
setSize(300,200);
show( );
}
}
1) 能接受用户调用该程序时的一个正整数参数(如:执行时使用java TestX 100);
2) 计算出小于该数的所有素数(即:只能被1和它自身整除的数),并打印在屏幕上。
1.尝试写一个Applet,并使其在界面中位置(100,100)处开始打印红色的字符串“你好”。3.已知有一名为TeaTest.class的Applet文件存放在http://www.sut.edu.cn/tea位置上,请写一个简单HTML文件,实现对该Applet的加载。2. 一个字符界面的Java Application 程序,程序名为TestX.java,实现以下功能:
1) 能接受用户调用该程序时的一个正整数参数(如:执行时使用java TestX 100);
2) 计算出小于该数的所有素数(即:只能被1和它自身整除的数),并打印在屏幕上。
3. 请写出一个主类,打印出所有水仙花数,水仙花数是指3位数的各位数值的立方和等于其本身,其中,在java.lang.Math 中有pow(int x,int y)方法可求出x的y次幂。
三、阅读程序,写出结果
import java.io.*;
public class Class1 {
public static void main( String args[] )
{ int i=args.length();
For(int j=0;j<i;j++)
System.out.println( args[i]);
}
}
上面程序经过编译后,在DOS提示符输入:
java Class1 I am a Student
则该程序打印的结果是
2.阅读程序, 在画线处写出该程序完成的功能
class Xyz implements Runnable
{ long s=0,n;
public void run()
{
for(int i=1;i<=n;i++)
s+=i;
}
}
public class ThreadTest {
public static void main(String args[])
{
Xyz r = new Xyz();
r.n=1000000;
Thread t1 = new Thread(r);
Thread t2 = new Thread(r);
t1.start();
t2.start();
}
}
该程序实现的功能:
3.阅读程序,在画线处写出该程序的结果:
import java.io.* ;
public class Test
{ public static void main(String args[ ])
{ int x=10,y=20,z=30;
x=x>y?x:y;
x=x>z?x:z;
System.out.println("Maxint="+x);
}
}
该程序运行结果是
4.阅读程序,在画线处写出该程序的结果:
import java.io.* ;
public class Test
{ public static void main(String args[ ])
{
SubClass S=new SubClass(210,220,230);
System.out.println("a="+S.a+ "; b="+ S.b+"; c= "+S.c);
}
}
class SubClass
{ int a,b,c;
SubClass(int aa,int bb,int cc)
{ a=aa; b=bb; c=cc;
}
}
该程序运行结果是
5.阅读程序,在画线处写出该程序完成的功能
import java.awt.*;
public class abc
{ public static void main(String args[])
{ Frame f=new Frame();
Label L = new Label("祝考试成功");
f.add(L);
f.setSize(400,500);
f.show();
}
}
该程序实现了
1.阅读程序,在画线处写出该程序的功能;
import java.awt.*;
import java.applet.Applet;
public class Applet1 extends Applet
{
public void paint( Graphics g )
{
g.setColor(Color.red);
g.drawString( "This is TestColor!" , 30,150 );
}
}
该程序
3.阅读程序
import java.awt.*;
import java.applet.*;
public class Test_FillCircle extends Applet {
public void paint(Graphics g) {
g.setFont(new Font(“宋体”,Font.NORMAL,24))
g.setColor(Color.blue);
g.drawString("This is draw a circle",100,100);
g.setColor(Color.RED);
g.fillArc(100, 100, 200,200,0,360);
} }
该方法主要完成
2.阅读程序,在画线处写出该程序的结果:
import java.io.* ;
public class Test
{ public static void main(String args[ ])
{
SubClass S=new SubClass(210,220,230);
System.out.println("a="+S.a+ "; b="+ S.b+"; c= "+S.c); }
}
class SuperClass
{ int a,b;
SuperClass(int aa , int bb)
{ a=aa; b=bb; }
}
class SubClass extends SuperClass
{ int c;
SubClass(int aa,int bb,int cc)
{ super(aa,bb);
c=cc;
}
}
4.阅读程序, 在画线处写出该程序完成的功能
class Xyz implements Runnable
{ int i,s=0;
public Xyz(int i){ this.i=i; }
public void run() {
while (i>0) { s*=i; i--; }
System.out.println(s);
}
}
public class ThreadTest {
public static void main(String args[]) {
Xyz r1 = new Xyz(100);
Xyz r2 = new Xyz(66);
Thread t1 = new Thread(r1);
Thread t2 = new Thread(r2);
t1.start();
t2.start();
}
}
该程序
1.阅读程序,为画线语句加注释;
import java.awt.*;
import java.applet.Applet;
public class DrawMyImage extends Applet
{
Image myImage;
public void init( ){
myImage = getImage(getDocumentBase( ),"pica.jpg"); //
}
public void paint(Graphics g){
g.drawImage(myImage,0,0,this); //
}
}
2.阅读程序,在画线处写出该程序完成的功能
import java.awt.*;
public class abc
{ public static void main(String args[])
{ FrameOut f=new FrameOut();
}
}
class FrameOut extends Frame
{ public FrameOut( )
{ super("提交对话窗体");
Button btn = new Button("确定");
add(btn);
setSize(300,200);
show( );
}
}
解决方案 »
- Java处理bmp图像,怎样操作BMP位图的数据??(想对图像的各个像素进行操作) (可追加)在线等
- 求助问题解决办法....高手请进...
- “JAVA”的标准读法?!
- 在java1.4中如何用schema验证xml的有效性?
- JFileChooser可以选择文件,那选择文件夹该如何实现呢?
- 谁有decafe pro 3.9 的注册版?
- 请问:怎么两个double型的数据相减后,用java.lang.math.abs算绝对值不对呢?
- java 2 sdk如何使用socket通过代理服务器访问lan外面的主机?请指教,谢谢
- 这个问题???
- eclipse控制台涉及的输入流怎么实现?
- JRE的classloader是如何加载class的??
- xml简单问题????
水仙花数:class OutputAll
{
public static void main(String arg[])
{
int i;
for(i=100;i<1000;i++)
{
int j;
j=i;
int a,b,c;
a=j/100;
b=(j%100)/10;
c=(j%100)%10;
j=(int)Math.pow(a,3)+(int)Math.pow(b,3)+(int)Math.pow(c,3);
if(j==i)
System.out.print("\t"+i);
}
}}
其它不讲,都告诉你感觉误人子弟。