单选题Import java.applet.Applet; Import java.awt*; Public class ImageDemo extends Applet{ Image img; Public void init(){ Img=getImage(getCodeBase(),”11.gif”);//1 } Public void paint(Graphics g){ Int w=img.getHeight(this); Int h=img.getHeight(this); g.drawImage(img,120,60,w/2,h/2,this);//2 g. drawImage(img,150,0,w*2,h*2,this);//3 } }以上代码第()行将图像放大。A1B2C3D代码并没有将图像放大
单选题
Import java.applet.Applet; Import java.awt*; Public class ImageDemo extends Applet{ Image img; Public void init(){ Img=getImage(getCodeBase(),”11.gif”);//1 } Public void paint(Graphics g){ Int w=img.getHeight(this); Int h=img.getHeight(this); g.drawImage(img,120,60,w/2,h/2,this);//2 g. drawImage(img,150,0,w*2,h*2,this);//3 } }以上代码第()行将图像放大。
A
1
B
2
C
3
D
代码并没有将图像放大
参考解析
解析:
暂无解析
相关考题:
下面的Applet获取了相对于getDocumentBase()方法返回的目录路径为graph/java.gif的图像文件,并将它显示出来。在下面程序的划线处填入相应的语句。import java.awt.*;import java.applet.Applet;public class Test extends Applet {Image img;public void init() {【 】}public void paint (Graphics g) {g.drawlmage (img,30,25,this);}}
下列Java源程序结构中前三种语句的次序,正确的是A.import, package, public classB.import必为首,其他不限C.public class, import, packageD.package, import, public class
将下面Applet程序补充完整。import java.awt.*:import java.apptet.*;public class Hi ______ {public void paint(Graghics g) {g.drawstring("Hi!",2.5,2.5);}}
下列Applet程序中,指定s为字符串类型,将s绘制在屏幕上,请将程序补充完整。import java.applet.Applet;import java.awt.Craphics;public class testl8_1 extends Applet {______String s;public void init (){s=new String("Hello World");}public Void______(Graphics g) {g.______(s,10,25);}}
在下面Java Applet程序的下画线处填入代码,使程序完整并能够正确运行。import java.applet.*;import java.awt.*;public class HelloWorld ______ {public void paint(Graphics g) {g.drawString("Hello World!",25,25);}}
下面Applet在窗口中实现一个不可编辑的TextField,并且显示“ok”。在横线处填入正确的语句。import java.applet.Applet;import java.awt.t;public class Test extends Applet {TextField tf;public void init () {setLayout (new GridLayout(1,0);tf=new TextField("ok");【 】add(tf);}}
下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }
将下面的程序补充完整。注意:不改动程序结构,不得增行或删行。import java.appplet.Applet;import java.awt.Graphics;public class ex1 extends Applet{public void paint(Graphics______){int i=682;gap.drawstring(Integer.______(i),20,60);}}
请将下面的Applet程序补充完整。import java. awt. *;import java. applet. *;public class Hi【 】{public void paint(Graphics g){g. drawString("Hi!", 25, 25);}}
下列代码的输出结果是( )。class parent{void printme(){System.out.println("parent");}}class child extends parent{void printme(){System. out.println("child");}void printall(){super, printme();this.printme();printme();}}public class test{public static void main(String args[]){child myc=new child();myc.printall();}}A.import java.awt.*;B.import java.applet.applet;C.import java.io.*;D.import java, awt.graphics;
定义JavaApplet程序时,必须有的import语句是 ( )A.import java.applet.Applet;B.import java.io.*;C.import java.awt.event;D.import java.lang.*;
下列Applet实现键盘事件处理,当一个键按下时,判断是否为26个英文字母,并输出该字母。选择正确的语句填入横线处。 import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class ex34 extends Applet { String str = ""; public void init() { addKeyListener (new KeyAdapter (} { ______ { char ch; ch = ke.getKeyChar(); if((ch >= 'a' ch <= 'z') || (ch >= 'A' ch <= 'Z')) str = "字母:"+ ch; else str ">"不是字母"; repaint(); } }); requestFocus(); } public void paint(Graphics g) { g.drawString(str, 50, 50); } }A.public void keyPress(KeyEvent ke)B.public void keyTyped(KeyEvent ke)C.public void keyTyped(Event ke)D.public void keyPressing(KeyEvent ke)
下列Applet实现了使用灰度值递减的顺序显示0~9,选择正确的语句填入横线处。 import java.applet.*; import java.awt.*; import java.awt.Color; public class ex24 extends Applet { public void paint(Graphics g) { int r = 0, g1 = 0, b = 0, j = 10; for(int i - 0; i < 10; i ++) { g.setColor(new Color(r, g1, b)); r += 25; g1 +=25; b +=25; j += 10; } } }A.g.drawString(i, j, 30);B.g.drawString("" + i, j, 30);C.drawString(i,j, 30);D.drawstring("" + i,j, 30);
下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }
请在下划线处填入代码,使程序能够正确运行。import java .awt.*;import java .applet.*;public class SayHi extends Applet{public void【 】(Graphics g){g .drawString(“Hi!”20,20);}}
一个程序中,package、import、和class的排放次序是()A、package、import、classB、import、package、classC、三者任意D、class在最后,import、package排放次序任意
Import java.applet.Applet; Import java.awt*; Public class ImageDemo extends Applet{ Image img; Public void init(){ Img=getImage(getCodeBase(),”11.gif”);//1 } Public void paint(Graphics g){ Int w=img.getHeight(this); Int h=img.getHeight(this); g.drawImage(img,120,60,w/2,h/2,this);//2 g. drawImage(img,150,0,w*2,h*2,this);//3 } }以上代码第()行将图像放大。 A、1B、2C、3D、代码并没有将图像放大
在单一文件中import、class和package的正确出现顺序是()A、package,import,classB、class,import,packageC、import,package,classD、package,class,import
在编写Java Application程序时,若需要使用到标准输入输出语句,必须在程序的开头写上()语句。A、import java.awt.* ;B、import java.applet.Applet ;C、import java.io.* ;D、import java.awt.Graphics ;
定义Java.Applet程序时,必须有的import语句是()。A、import java.awt.event;B、import java.util. * ;C、import java.applet.Applet;D、import java.1ang.* ;
package sun.scjp; public enum Color { RED, GREEN, BLUE } package sun.beta; // insert code here public class Beta { Color g = GREEN; public static void main( String[] argv) { System.out.println( GREEN); } } The class Beta and the enum Color are in different packages. Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?()A、 import sun.scjp.Color.*;B、 import static sun.scjp.Color.*;C、 import sun.scjp.Color; import static sun.scjp.Color.*;D、 import sun.scjp.*; import static sun.scjp.Color.*;E、 import sun.scjp.Color; import static sun.scjp.Color.GREEN;
Given a class Repetition: 1.package utils; 2. 3.public class Repetition{ 4.public static String twice(Strings){returns+s;} 5.} and given another class Demo: 1.//insert code here2. 3.public class Demo{ 4.public static void main(String[]args){ 5.System.out.println(twice("pizza")); 6.} 7.} Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A、import utils.*;B、static import utils.*;C、importutils.Repetition.*;D、static importutils.Repetition.*;E、import utils.Repetition.twice();F、import static utils.Repetition.twice;G、static import utils.Repetition.twice;
定义类: package utils; public class Rep{ public static String twice (String s){return s+s ;} } 再定义另一个类Demo: //insert code here public class Demo{ public static void main (String[] args){ System. out .println( twice( "Hello")); } } 在第一行插入哪项代码,可以使程序正常编译和执行?() A、import utils.*;B、 import utils.Rep.*;C、 import static utils.Rep.twice;D、 static import utils.Rep.twice;
单选题在单一文件中import、class和package的正确出现顺序是()Apackage,import,classBclass,import,packageCimport,package,classDpackage,class,import
单选题定义类: package utils; public class Rep{ public static String twice (String s){return s+s ;} } 再定义另一个类Demo: //insert code here public class Demo{ public static void main (String[] args){ System. out .println( twice( "Hello")); } } 在第一行插入哪项代码,可以使程序正常编译和执行?()Aimport utils.*;B import utils.Rep.*;C import static utils.Rep.twice;D static import utils.Rep.twice;
单选题Given a class Repetition: 1. package utils; 2. 3. public class Repetition { 4. public static String twice(String s) { return s + s; } 5. } and given another class Demo: 1. // insert code here 2. 3. public class Demo { 4. public static void main(String[] args) { 5. System.out.println(twice(”pizza”)); 6. } 7. } Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A import utils.*;B static import utils.*;C import utils.Repetition.*;D static import utils.Repetition. *;E import utils.Repetition.twice();F import static utils.Repetition.twice;G static import utils.Repetition.twice;