JAVA±ÊÊÔÌâÑ¡ÔñÌâ
1ÏÂÃæÄĸöÊÇÕýÈ·µÄÀàÉùÃ÷£¿¼ÙÉèÿһ¶ÎÎı¾¶¼×öΪһ¸öÃû³ÆΪFred.javaµÄÎļþµÄÈ«²¿ÄÚÈÝ£¿ a
a).
public class Fred{
public int x = 0;
public Fred (int x){
this.x=x;
}
}
b).
public class fred{
public int x = 0;
public Fred (int x){
this.x=x;
}
}
c).
public class Fred extends MyBaseClass, MyOtherBaseClass{
public int x = 0;
public Fred(int xval){
x=xval;
}
}
d).
protected class Fred{
private int x = 0;
private Fred (int xval){
x=xval;
}
}
A. a)
B. b)
C. c)
D. d)
2.ÔÚÀàÉè¼ÆÖУ¬ÀàµÄ³ÉÔ±±äÁ¿ÒªÇó½ö½öÄܹ»±»Í¬Ò»packageϵÄÀà·ÃÎÊ£¬ÇëÎÊÓ¦¸ÃʹÓÃÏÂÁÐÄĸöÐÞ´Ç´Ê d
A. protected
B. public
C. private
D. ²»ÐèÒªÈκÎÐÞ´Ç´Ê
3.ÏÂÃæÄǸöÊÇRunable½Ó¿ÚµÄ·½·¨£¿a
A. run
B. start
C. yield
D. stop
4.¸ø³öÀà¿ò¼ÜÈçÏ£º
class Example{
private int x;
//rest of class body…
}
¼Ù¶¨Í¨¹ýjava Exampleµ÷ÓÃx£¬ÏÂÁÐÄĸöÓï¾äÄܹ»Ê¹µÃÔÚExample.javaµÄmain·½·¨ÖÐÖ±½Ó·ÃÎÊx? b
A. ÉùÃ÷xΪpublic¶ø²»ÊÇprivate
B. ÉùÃ÷xΪstatic¶ø²»ÊÇprivate
C. ÉùÃ÷xΪprotected¶ø²»ÊÇprivate
D. ÉùÃ÷xΪfinal¶ø²»ÊÇprivate
5.¸ø³ö£ºÒÔÏÂÀà
public class ReturnIt{
ReturnType methodA(byte x,double y){
return (short)x/y*2;
}
}
¶ÔÓÚÔÚµÚ¶þÐеķ½·¨methodA£¬ËûµÄ·µ»ØÖµµÄÀàÐÍÓ¦¸ÃÊÇ f
A. int
B. byte
C. long
D. short
E. float
F. double
6.ÏÂÃæÁгöµÄÄǸöÊÇjavaµÄ±£Áô×Ö£¿ b
A. if
B. goto
C. while
D. case
E. then
7.Ê®½øÖƱäÁ¿iµÄֵΪ12£¬ÄÇô°Ë½øÖƵıäÁ¿iµÄֵΪ£º d
A. O08
B. O10
C. O12
D. O14
E. O16
8.ÏÂÁÐÄÄЩ˵·¨ÊÇÕýÈ·µÄ£¿ d
A. ÔÚcollectionÀàÊ÷ÉÏ£¬×²ãµÄÀà
Ïà¹ØÎĵµ£º
ÔÚJavaÖУ¬Ê¹ÓÃnew¹Ø¼ü×ÖºÍClass.forName("a.class.Name").newInstance¶¼¿ÉÒÔ´´½¨¶ÔÏó£¬ËüÃÇÓÖÓÐʲôÇø±ðÄØ£¿
1¡¢ÀàµÄ¼ÓÔØ·½Ê½²»Í¬¡£
ÔÚÖ´ÐÐClass.forName("a.class.Name")ʱ£¬JVM»áÔÚclassapthÖÐÈ¥ÕÒ¶ÔÓ¦µÄÀಢ¼ÓÔØ£¬ÕâʱJVM»áÖ´ÐиÃÀàµÄ¾²Ì¬´úÂë¶Î¡£ÔÚʹÓà ......
¡¡¡¡»¥ÁªÍøµÄáÈÆð£¬Ê¹µÃPC´Ó²úÒµÖÐÐÄÏò±ßÔµ¹ý¶É£¬¶øÀú¾20ÓàÄêµÄ·¢Õ¹£¬PCÊг¡Ò²Ç÷ÓÚ±¥ºÍ£¬´½Íö³Ýº®£¬Õâ½Ð¿¿PC³Ô·¹µÄ΢ÈíÈçºÎ²»¼±£¿ÎüÈ¡Á˵±Ä꿪·¢ä¯ÀÀÆ÷Èí¼þµÄ½Ìѵ£¬2000Äê6Ô£¬Î¢ÈíÆô¶¯.Net¼Æ»®£¬½ø¾üÍøÂç·þÎñÊг¡£¬±È¶û·¸Ç´Ä×ÔÐŵسƣº"ÊÀ½çÉÏËùÓÐÒ»Çж¼½«°üÀ¨ÔÚ»¥ÁªÍø·þÎñÖС£"
¡¡¡¡.NETµÄ˼ÏëÆäʵÊÇÀ´Ô ......
1¡¢ Ò»¸öÊýÈç¹ûÇ¡ºÃµÈÓÚÆäÒò×Ó£¨³ýÁ˱¾ÉíÒÔÍâµÄÔ¼ÊýÖ®ºÍ£©£¬¸ÃÊý¾Í³ÆΪ“ÍêÊý”¡£±àдһ¸ö Java Application ³ÌÐò£¬Çó³ö 1000 ÒÔÄÚµÄËùÓÐÍêÊý¡£
public class homework11
{
public static void main(String[] args)
//Êä³ö1000ÒÔÄÚµÄËùÓÐÍêÊý
{
int sum; ......
1¡¢±àдһ¸ö¼òµ¥µÄÎı¾±à¼Æ÷£¬ÒªÇ󣺾ßÓдò¿ª¡¢±£´æ¡¢Ð½¨£¬Õ³Ìù¡¢¸´ÖƵȹ¦ÄÜ£»¾ßÓÐÒ»¸ö¹¤¾ßÌõ¡£
1.1¡¢³ÌÐòÔ´Â루²Î¼ûmenu.java£©£º
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
public class menu extends JFrame impl ......
µÚÒ»£º
1.StringÊÇ×î»ù±¾µÄÊý¾ÝÀàÐÍô£¿
´ð£º²»ÊÇ¡£»ù±¾µÄÊý¾ÝÀàÐÍ°üÀ¨£ºbyte,int,char,long,float,double,booleanºÍshort.
java.lang.StringÀàÊÇfinalÀàÐ͵ģ¬Òò´Ë²»¿ÉÒԼ̳ÐÕâ¸öÀ࣬²»ÄÜÐÞ¸ÄÕâ¸öÀà¡£
2.¾²Ì¬±äÁ¿ºÍʵÀý±äÁ¿µÄÇø±ð£¿
´ð£ºstatic i = 10 ;//³£Á¿
&nb ......