注意:此页面搜索的是所有试题
东北林业大学-Java程序设计(专升本)
27. (问答题) public class Sum
{ public static void main( String args[ ])
{ double sum = 0.0 ;
for ( int i = 1 ; i <= 100 ; i + + )
sum += 1.0/(double) i ;(本题8.0分)
28. (问答题) import java.awt.*; import java.applet.Applet; public class DrawMyImage extends Applet { Image myImage; // 定义一个图像类Image的对象myImage public void init( ) { myImage = getImage(getDocumentBase( ),"pica.jpg"); } public void paint(Graphics g) { g.drawImage(myImage,0,0,this); } }(本题8.0分)
29. (问答题) public class Class1 { public static void main( String args[] ) { Fact N = new Fact( 4 ); System.out.println( N.fact( ) ); } } class Fact { int n ; Fact( int nn ) { n = nn; } int fact( ) { int i , f = 1; for ( i=1; i<=n; i++ ) f = f*i; return f; } }
30. (问答题) import java.awt.*; import java.applet.Applet; public class Applet1 extends Applet { public void paint( Graphics g ) { g.drawLine( 30,5,100,45 ); g.drawRect( 30,50,50,20 ); g.drawOval( 30,80,50,40 ); g.drawString( "They are figures!" , 30,150 ); } } (本题8.0分)
28. (问答题) import java.awt.*; import java.applet.Applet; public class DrawMyImage extends Applet { Image myImage; // 定义一个图像类Image的对象myImage public void init( ) { myImage = getImage(getDocumentBase( ),"pica.jpg"); } public void paint(Graphics g) { g.drawImage(myImage,0,0,this); } }(本题8.0分)
29. (问答题) public class Class1 { public static void main( String args[] ) { Fact N = new Fact( 4 ); System.out.println( N.fact( ) ); } } class Fact { int n ; Fact( int nn ) { n = nn; } int fact( ) { int i , f = 1; for ( i=1; i<=n; i++ ) f = f*i; return f; } }
30. (问答题) import java.awt.*; import java.applet.Applet; public class Applet1 extends Applet { public void paint( Graphics g ) { g.drawLine( 30,5,100,45 ); g.drawRect( 30,50,50,20 ); g.drawOval( 30,80,50,40 ); g.drawString( "They are figures!" , 30,150 ); } } (本题8.0分)