首页
试卷库
试题库
当前位置:
X题卡
>
所有题目
>
题目详情
执行下面的赋值语句后,a的值为______。 a=Float.valueOf("12.34").floatValue( );
查看本题答案
包含此试题的试卷
计算机等级考试《填空》真题及答案
点击查看
你可能感兴趣的试题
设执行下面的赋值语句a=FloatvalueOf12.34.floatValue后a的值是
a="12.34"
a=12.34
a=1234
a=12
执行下面的赋值语句后a的值为______a=Float.valueOf12.34.floatValu
设执行下面的赋值语句A=Float.valueOf12.34.floatValue后a的值是
a="12.34"
a=12.34
a=1234
a=12
执行下面的赋值语句后a的值为【8】a=Float.valueOf12.34.fioatValue;
设执行下面的赋值语句a=Float.valueOf12.34.floatValue之后a的值是
a="12.34"
a=12.34
a=1234
a=12
执行下面的赋值语句后a的值为【8】a=Float.valueOf12.34floatValue
执行下面的赋值语句后a的值为【8】 a=Float.valueOf12.34floatValue
执行下面的赋值语句后a的值为______ a=Float.valueOf12.34.floatVa
设执行下面的赋值语句a=Float.valueOf12.34.floatValue之后a的值是
a="12.34"
a=12.34
a=1234
a=12
执行下面的赋值语句后a的值为【8】 a=Float.valueOf12.34.fioatValue
设执行下面的赋值语句a=Float.valueOf12.34.floatValue之后a的值是
a="12.34"
a=12.34
a=1234
a=12
假设变量intVar为一个整型变量则执行赋值语句intVar=2+3之后变量intVar的值与执行赋
执行下面的赋值语句后a的值为______ a=Float.valueof12.34.floatVa
执行下面的赋值语句后a的值为______a=Float.valueof12.34.floatValu
设执行下面的赋值语句a=Float.valueOf12.34.floatValue之后a的值是
a="12.34"
a=12.34
a=1234
a=12
设执行下面的赋值语句A=Float.valueOf12.34.floatValue后a的值是
a="12.34"
a=12.34
a=1234
a=12
执行下面的赋值语句后a的值为【8】a=Float.valueOf12.34.floatValue;
执行下面的赋值语句后a的值为______a=Float.valueOf12.34.floatValu
设执行下面的赋值语句a=FloatvalueOf12.34.floatValue后a的值是
a="12.34"
a=12.34
a=1234
a=12
设执行下面的赋值语句
A=Float.valueOf("12.34").floatValue();
后,a的值是(
)。
a="12.34"
a=12.34
a=1234
a=12
热门试题
更多
本题的功能是用文本框来设定表盘中指针的位置窗口中有一个画板和两个文本框画板中绘制了一个表盘和时针分针通过文本框分别设定时和分表盘中的时针和分针就会指到对应的位置上importjava.awt.*;importjava.awt.event.*;importjava.awt.geom.*;importjavax.swing.*;importjavax.swing.event.*;publicclassjava3publicstaticvoidmainString[]argsTextTestFrameframe=newTextTestFrame;frame.setDefauhCloseOperationJFrame.EXIT_ON_CLOSE;frame.show;classTextTestFrameextendsJFramepublicTextTestFramesetTitlejava3;setSizeDEFAULT_WIDTHDEFAULT_HEIGHT;ContainercontentPane=getContentPane;DocumentListenerlistener=newDocurnentListener;JPanelpanel=newJPanel;hourField=newJTextField123;panel.addhourField;hourField.getDocument.addDocumentListenerthis;minuteField=newJTextField003;panel.addminuteField;minuteField.getDocument.addDocumentListenerlistener;contentPane.addpanelBorderLayout.SOUTH;clock=newClockPanel;contentPane.addclockBorderLayout.CENTER;publicvoidsetClocktryinthours=Integer.parseInthourFieldgetText.trim;intminutes=Integer.parseIntminuteField.getText.trim;clock.setTimehoursminutes;catchNumberFormatExceptionepublicstaticfinalintDEFAULT_WIDTH=300;publicstaticfinalintDEFAULT_HEIGHT=300;privateJTextFieldhourField;privateJTextFieldminuteField;privateClockPanelclock;privateclassclockFieldListenerextendsDocumentListenerpublicvoidinsertUpdateDocumentEventesetClock;publicvoidremoveUpdateDocumentEventesetClock;publicvoidchangedUpdateDocumentEventeclassClockPanelextendsJPanelpublicvoidpaintComponentGraphicsgsuper.paintComponentg;Graphics2Dg2=Graphics2Dg;Ellipse2Dcircle=newEllipse2D.Double002*RADIUS2*RADIUS;g2.drawcircle;doublehourAngle=Math.toRadians90-360*minutes/12*60;drawHandg2.hourAngleHOUR_HAND_LENGTH;doubleminuteAngle=Math.toRadians90-360*minutes/60;drawHandg2minuteAngleMINUTE_HAND_LENGTH;publicvoiddrawHandGraphics2Dg2doubleangledoublehandLengthPoint2Dend=newPoim2D.DoubleRADIUS+handLength*Math.cosangleRADIUS-handLength*Math.sinangle;Point2Dcenter=newPoint2D.DoubleRADIUSRADIUS;g2.drawnewLine2D.Doublecenterend;publicvoidsetTimeinthintmminutes—h*60+mrepaint;privatedoubleminutes=0;privatedoubleRADIUS=100;privatedoubleMINUTE_HAND_LENGTH=0.8*RADIUS;privatedoubleHOUR_HAND_LENGTH=0.6*RADIUS;
本题中定义了长度为20的一维整型数组a并将数组元素的下标值赋给数组元素最后打印输出数组中下标为奇数的元素publicclassjava1publicstaticvoidmainString[]argsinta[]=______;inti;for______;i++a[i]=i;fori=0;i<20;i++if______System.out.printa[+i+]=+a[i]+;
本题的功能是通过鼠标确定两个点然后画两点间的直线窗口中有一个按钮Drawline单击该按钮后它就处于按下状态然后用鼠标在窗口中单击一下在单击的地方就会出现一个坐标圆点用鼠标在另外一个地方单击一下又会出现另外一个圆点并且此时在两个坐标圆点间画出一条直线且Drawline处于可用状态再单击这个按钮就可以画另外一条直线importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;classEventQueuePanelextendsJPanelimplementsActionListenerEventQueuePanelJButtonbutton=newJButtonDrawline;addbutton;button.addActionListenerthis;publicvoidactionPerformedAclionEventevtGraphicsg=getGraphics;______p=getClick;g.drawOvalp.x-2p.y-244;Pointq=getClick;g.drawOvalq.x-2q.y-244;g.drawLinep.xp.yq.xq.y;g.dispose;publicPointgetClickEventQueueeq=Toolkit.getDefaultToolkit.getSystemEventQueue;whiletruetryAWTEventevt=eq.getNextEvent;ifevt.getID==MouseEvent.MOUSEPRESSEDMouseEventmevt=MouseEventevt;Pointp=______;Pointtop=getRootPane.getLoeation______p.x-=top.x;p.y-=top.y;returnp;catchInterruptedExceptioneprivateinty=60;classEventQueueFrameextendsJFramepublicEventQueueFramesetTitlejava2;setSize300200;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;ContainercontentPane=getContentPane;contentPane.addnewEventQueuePanel;publicclassjava2publicstaticvoidmainString[]argsFrameframe=newEventQueueFrame;frame.show;
窗体由多个部分组成每个部分称为一个11大部分的窗体只有12
本题统计字符串str中字母a出现的次数其中str为7&asdfasdf873eat687#a14a字母’a’存储在字符变量c中最后打印输出结果publicclassjava1publicstaticvoidmainString[]argsStringstr=*&7asdfadf873eat687#a14a;charc;intsum=0;inti=0;doc=____________if______sum++;i++;while______;System.out.printlnsum=+sum;
本题中主窗口有一个按钮打开对话框和一个文本域单击按钮打开对话框后会弹出一个对话框对话框上有两个按钮Yes和No单击对话框上的Yes和No按钮后返回主窗口并在右侧文本域中显示刚才所单击的按钮信息importjava.awt.event.*;importjava.awt.*;classMyDialog______implementsActionListenerstaticfinalintYES=1NO=0;intmessage=-1;Buttonyesno;MyDialogFramefStringsbooleanbsuperfsb;yes=newButtonYes;yes.addActionListenerthis;no=newButtonNo;no.addActionListenerthis;setLayoutnewFlowLayout;addyes;addno;setBounds6060100100;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventemessage=-1;setVisiblefalse;;publicvoidactionPerformedActionEventeife.getSource==yesmessage=YES;setVisiblefalse;elseife.getSource==nomessage=NO;setVisiblefalse;publicintgetMessagereturnmessage;classDwindowextendsFrameimplementsActionListenerTextAreatext;Buttonbutton;MyDialogdialog;DwindowStringssupers;text=newTextArea522;button=newButton打开对话框;button.addActionListenerthis;setLayoutnewFlowLayout;addbutton;addtext;dialog=newMyDialogthisDialogtrue;setBounds6060300300;setVisibletrue;validate;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;publicvoidactionPerformedActionEventeife.getSource==button______;ifdialog.getMessage==MyDialog.YEStext.appendn你单击了对话框的yes按钮;elseifdialog.getMessage==MyDialog.NOtext.append/n你单击了对话框的No按钮;publicclassjava2publicstaticvoidmainStringargs[]newDwindowjava2;
本题是一个Applet它的功能是在窗口上添加12×12个标签并且横向和纵向标签的颜色为黑白相间importjava.applet.*;importjava.awt.*;importjava.awt.event.*;publicclassjava2extendsAppletGridLayoutgrid;publicvoidinitgrid=newGridLayout1212;setLayoutgrid;Label______=newLabel[12][12];forinti=0;i<12;i++forintj=0;j<12;j++label[i][j]=______;ifi+j%2==0label[i][j].setBackgroundColor.black;elselabel[i][j].setBackgroundColor.white;addlabel[i][j];
本题利用递归方法求前n个自然数的和n=10publicclassjava1publicstaticvoidmainString[]argsintsum=add10;System.out.println1+2+...+9+10=+sum;publicstaticintadd______ifn==1______;else______;
本题的功能是监听对于菜单项和工具条的操作窗口中有一个菜单Color和一个工具体菜单Color中有菜单项YellowBlueRed和Exit每个菜单项都有对应的图形单击前三个颜色菜单项主窗口就变成对应的颜色单击Exit则退出程序工具条上有4个按钮分别为三个颜色按钮和一个退出程序的按钮单击任意一个颜色按钮主窗口将变成按钮对应的颜色单击退出程序按钮则退出程序importjava.awt.*;importjava.awt.event.*;importjava.beans.*;importiavax.swing.*;publicclassjava3publicstaticvoidmainString[]argsToolBarFrameframe=newToolBarFrarne;frame.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE;frame.show;classToolBarFrameextendsJFramepublicToolBarFramesetTitlejava3;setSizeDEFAULT_WIDTHDEFAULT_HEIGHT;ContainercontentPane=getContentPane;panel=newJPanel;contentPane.addpanelBorderLayout.CENTER;
本题中窗口的背景色为系统桌面的颜色在窗口中分别画空心和实心的黑色矩形深灰色圆角矩形和浅灰色椭圆形并且画白色粗体的欢迎学习Java!字符串importjava.awt.*;importjavax.swing.*;publicclassjava2publicstaticvoidmainString[]argsFillFrameframe=newFillFrame;frame.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE;frame.show;classFillFrameextendsJFramepublicFillFramesetTitlejava2;setSizeWIDTHHEIGHT;FillPanelpanel=newFillPanel;panel.setBackroundSystemColor.desktop;ContainercontentPane=getContentPane;contentPane.addpanel;publicstaticfinalintWIDTH=400;publicstaticfinalintHEIGHT=250;classFillPanelextendsJPanelpublicvoidpaintComponentGraphicsg______;g.setColornewColor101010;g.drawRect101010030;g.setColornewColor100100100;g.drawRoundRect15010100301515;g.setColornewColor150150150;g.drawOval280108030;g.setColornewColor101010;g.fillRect1011010030;g.setColornewColor100100100;g.fillRoundRect150110100301515;g.setColornewColor150150150;g.fillOval2801108030;g.setColorColor.white;Fontf=newFont宋体______20;g.setFontf;g.drawstring欢迎学习Java!150200;
本题的功能是计算1~10之间除了5以外的各个自然数的和publicclassjava1publicstaticvoidmainString[]argsinti=1;intsum=0;whilei<=10ifi==5______;______;______;i++;System.out.printlnsum=+sum;
本题的功能是用复选按钮来控制鼠标右键的弹出菜单是否弹出窗口中有一个复选按钮弹出菜单如果选中该复选按钮后鼠标置于窗口上单击鼠标右键会弹出一个菜单单击菜单项中的选项后后台会输出单击的菜单项如果取消该复选按钮的选择单击鼠标右键则不能弹出菜单importjava.awt.*;importjava.awt.event.*;classCanvasWithPopupextendsCanvasPopupmenupopup;CanvasWithPopupPopupMenupopupenableEventsAWTEvent.MOUSE_EVENT_MASK;this.popup=popup;voidaddPopupaddpopup;voidremovePopupremovepopup;protectedvoidprocessMouseEventMouseEventevtifpopup.getParent!=null&&evt.isPopupTriggerpopup.showevt.getComponentevt.getXevt.getY;super.processMouseEventevt;publicclassjava3extendsFrameimplementsItemListenerActionListenerCheckboxcb=newCheckbox弹出菜单false;CanvasWithPopupcanvas;java3superjava3;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;addcbBorderLayout.NORTH;cb.addItemListenerthis;PopupMenupopup=newPopupMenuButtonControl;popup.additem1;popup.additem2;popup.addActionListenerthis;canvas=newCanvasWithPopuppopup;addcanvasBorderLayout.CENTER;setSize100200;show;publicvoiditemStateChangedItemEVentevtswitchevt.getStatecaseItemEvent.SELECTED:canvas.addPopup;break;caseItemEvent.DESELECTED:canvas.removePopup;break;publicvoidactionPerformedActionEventevtSystem.out.printlnCgetActionCommand+isseIected;staticpublicvoidmainString[]argsnewjava3;
本题的功能是对列表项的操作包括删除添加和反选窗口中有两个列表框和5个按钮按钮标签代表着移除列表项的方向>代表只移除选中的列表项>>代表移除所有的列表项!代表反向选择列表项importjava.awt.*;importjava.awt.event.*;classjava3extendsFrameimplementsActionListener&ItemListenerfinalstaticintITEMS=10;ListItList=newListITEMStrue;ListrtList=newList0true;java3superjava3;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;GridBagLayoutgbl=newGridBagLayout;setLayoutgbl;addItList00151.01.0;addrtList20151.01.0;ItList.addActionListenerthis;ItList.addItemListenerthis;rtList.addActionListenerthis;rtList.addItemListenerthis;Buttonb;addb=newButton>101101.0;b.addActionListenerthis;addb=newButton>>111101.0;b.addActionListenerthis;addb=newButton<121101.0;b.addActionListenerthis;addb=newButton<<131101.0;b.addActionListenerthis;addb=FlewButton!141101.0;b.addActionListenerthis;forinti=0;i<ITEMS;i++ltList.additem+i;pack;show;voidaddComponentcompintxintyintwinthdoubleweightxdoubleweightyGridBagLayoutgbl=GridBagLayoutgetLayout;GridBagConstraintsc=newGridBagConstraints;c.fill=GridBagConstraints.BOTH;c.gridx=x;c.gridy=y;c.gridwidth=w;c.gridheight=h;c.weightx=weightx;c.weighty=weighty;addcomp;gbl.setConstraintscompc;voidreverseSelectionsList1forinti=0;i<1.length;i++ifl.isIndexSelectedil.deselecti;elsel.selecti;voiddeselectAllList1forinti=0;i<1.getItemCount;ittl.deselecti;voidreplaceItemList1Stringitemforinti=0;i<1.getItemCount;i+tif1.getItemi.equalsiteml.replaceItemitem+*i;voidmoveListl1List12booleanallifallforinti=0;i<l1.getItemCount;i++l2.addl1.getItemi;l1.removeAll;elseString[]items=l1.getSelectedItems;int[]itemIndexes=l1.getSelectedIndexes;deselectAlll2;forinti=0;i<items.length;i++l2.additems[i];l2.selectl2.getItemCount=1;ifi==0l2.makeVisiblel2.getItemCount=1;forinti=itemIndexes.length-1;i>=0;i--l1.removeitemIndexes[i];publicvoidactionPerformedActionEventevtStringarg=evt.getActionCommand;if>.equalsargmoveltListrtListfalse;elseif>>.equalsargmoveltListrtListtrue;elseif<.equalsargmovertListltListfalse;elseif<<.equalsargmovertListltListtrue;elseif!.equalsargifltList.getSelectedItems.length>0reverseSelectionsltList;elseifrtList.getSelectedItems.length>0reverseSelectionsrtList;elseObjecttarget=evt.getSource;iftarget==rtList||target==ItListreplaceItemListtargetarg;publicvoiditemStatedChangedItemEvententListtarget=Listevt.getSource;iftarget==ltListdeselectAllrtList;elseiftarget==rtListdeselectAllltList;publicstaticvoidmainString[]argsnewjava3;
本题的功能是定义图形按钮窗口中有两个图形按钮当鼠标移上去时图形按钮的图形将改变用鼠标单击按钮时图形按钮的图形又发生改变当鼠标左键松开或者移开鼠标后图形按钮的图形又恢复原样importjavax.swing.*;importjava.awt.*;publicclassjava3extendJButtonpublicjava3IconiconIconpressedIconrolloverthisicon;setFocusPaintedfalse;setRolloverEnabledtrue;setRolloverIconrollover;setPressedIconpressed;setBorderPaintedfalse;setContentAreaFilledfalse;publicstaticvoidmainString[]argsjava3b1=newjava3newImageIconjava3-redcube.gifnewImageIconjava3-redpaw.gifnewImageIconjava3-reddiamond.gif;java3b2=newjava3newImageIconjava3-bluecube.gifnewImageIconjava3-bluepaw.gifnewImageIconjava3-bluediamond.gif;JFramef=newJFrame;f.setTitlejava3;f.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE;c=f.getContentpane;c.setLayoutnewFlowLayout;c.addb1;c.addb2;f.pack;f.setVisibletrue;
本题的功能是求两个交叉图形的并减交和异或窗口中有4个单选按钮和一个图形面板面板中有两个交叉的图形选中其中一个单选按钮图形面板中以黑色填充的方式显示运算结果importjava.awt.*;importjava.awt.event.*;importjava.awt.geom.*;importjava.util.*;importjavax.swing.*;publicclassjava3publicstaticvoidmainString[]argsJFrameframe=newAreaTestFrame;frame.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE;frame.show;classAreaTestFrameextendsJFramepublicAreaTestFramesetTitlejava3;setSizeWIDTHHEIGHT;areal=newAreanewEllipse2D.Double100100150100;area2=newAreanewRectangle2D.Double150150150100;ContainerconfentPane=getContentpane;panel=newJPanelpublicvoidpaintComponentGraphicsgsuper.paintComponentg;Graphics2Dg2=Graphics2Dg;g2.drawarea1;g2.drawarea2;ifarea!=nullg2.fillarea;;contentPane.addpanelBorderLayout.CENTER;JPanelbuttonPanel=newJPanel;ButtonGroupgroup=newButtonGroup;JRadioButtonaddButton=newJRadioButton并false;buttonPanel.addaddButton;group.addaddButton;addButton.addActionListenernewActionListenerpublicvoidactionPerformedAetionEventeventarea=newArea;area.addarea1;area.addarea2;panel.repaint;;JRadioButtonsubtractButton=newJRadioButton减false;buttonPanel.addsubtractButton;group.addsubtractButton;subtractButton.addActionListenernewActionListenerpublicvoidactionPerformedActionEventeventarea=newArea;area.addarea1;area.subTractarea2;panel.repaint;;JRadioButtonintersectButton=newJRadioButton交false;buttonPanel.addintersectButton;group.addintersectButton;intersectButton.addActionListenernewActionListenerpublicvoidactionPerformedActionEventeventarea=newArea;area.addarea1;area.interseetarea2;panel.repaint;;JRadioButtonexclusiveOrButton=newJRadioButton异或false;buttonPanel.addexclusiveOrButton;group.addexclusiveOrButton;exclusiveOrButton.addActionListenernewActionListenerpublicvoidactionPerformedActionEventeventarea=newArea;area.addarea1;area.exclusiveorarea2;panel.repaint;;contentPane.addbuttonPanelBorderLayout.NORTH;privateJPanelpanel;privateAreaarea;privateAreaarea1;privateAreaarea2;privatestaticfinalintWIDTH=400;privatestaticfinalintHEIGHT=400;
______主要用于对数据库中的数据进行分组计算汇总和打印输出
本题的功能是用冒泡法对数组元素arr[]=301-970进行从小到大排列冒泡法排序是比较相邻的两个元素的大小然后把小的元素交换到前而publicclassjava1publicstaticvoidmainString[]argsintij;intarr[]=301-970;intn=______;fori=0;i<n-1;i++forj=i+1;j<n;j++ifarr[i]>arr[j]inttemp=arr[i];______;______;fori=0;i<n;i++System.out.printarr[i]+;
在下画线上补充代码本题的功能是输出字符串welcome!和表达式a/b=c以及输出//dosomethingPublicclassjava1PublicstaticvoidmainString[]argsSystem.out.println______;System.out.println______;System.out.println______;
本题将一个整形变量op1的二进制的低3位全部变成1publicclassjava1publicstaticvoidmainString[]args______op1=21;intop2=7;______res;______;System.out.printlnres;
本题用复选框来控制字体的显示窗口中有一个标签和两个复选按钮这两个复选按钮分别对应的字体的两个特点加粗和倾斜任意选中一个按钮或两个都选中标签上的字符串就显示对应的字体importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;classCheckBoxFrameextendsJFrameimplementsActionListenerpublicCheckBoxFramesetTitleCheckBoxTest;setSize300200;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;JPanelp=newJPanel;bold=addCheckBoxpBold;italic=addCheckBoxpItalic;getContentPane.addpSouth;panel=newCheckBoxTestPanel;getContentPane.addpanelCenter;publicJCheckBoxaddCheckBoxJPanelpStringnameJCheckBoxc=newJCheckBoxname;c.addActionListener;p.addc;returnc;publicvoid______intm=bold.isSelectedFont.BOLD:0+italic.isSelectedFont.ITALIC:0;panel.setFontm;privateCheckBoxTestPanelpanel;privateJCheckBoxbold;privateJCheckBoxitalic;classCheckBoxTestPanelextendsJPanelpublicCheckBoxTestPanelsetFontFont.PLAIN;publicvoidsetFontintmsetFontnewFontSansSerifm12;repaint;publicvoidpaintComponentGraphicsgsuper.paintComponentg;g.drawstringThequickbrownfoxjumpsoverthelazydog.050;publicclassjava2publicstaticvoidmainString[]argsJFrameframe=newCheckBoxFrame;frame.show;
本题中鼠标在窗口中单击一下就在单击的位置生成一个小矩形如果在小矩形上双击鼠标左键则删除小矩形importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;classMousePanelextendsJPanelextendsMouseMotionListenerpublicMousePaneladdMouseListenernewMouseAdapterpublicvoidmousePressedMouseEventevtintx=evt.getX;inty=evt.getY;current=findxy;ifcurrent<0addxy;publicvoidmouseClickedMouseEventevtintx=evt.getX;inty=evt.getY;ifevt.getClickCount>=2removecurrent;;addMouseMorionListenerthis;publicvoidpaintComponentGraphicsgsuper.paintComponent;forinti=0;i<nsquares;i++drawgi;publicintfindintxintyforinti=0;i<nsquares;i++ifsquares[i].x-SQUARELENGTH/2<=x&&x<=squares[i].x+SQUARELENGTH/2&&squares[i].y-SQUARELENGTH/2<=y&&y<=squares[i].y+SQUARELENGTH/2returni;return-1;publicvoiddrawGraphicsgintig.drawRectsquares[i].x-SQUARELENGTH/2squares[i].y-SQUARELENGTH/2SQUARELENGTHSQUARELENGTH;publicvoidaddintxintyifnsquares<MAXNSQUARESsquares[nsquares]=newPointxy;current=nsquares;nsquares++;repaint;publicvoidremoveintnifn<0||n>=nsquaresreturn;nsquares--;squares[n]=squares[nsquares];ifcurrent==ncurrent=-1;repaint;publicvoidmouseMovedMouseEventevtpublicvoidmouseDraggedMouseEventevtprivatestaticfinalintSQUARELENGTH=10;privatestaticfinalintMAXNSQUARES=100;privatePoint[]squares=newPoint[MAXNSQUARES];privateintnsquares=0;privateintcurrent=-1;classMouseFrameextendsJFramepublicMouseFramesetTitlejava3;setSize300200;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;ContainercontentPane=getContentPane;contentPane.addMousePanel;publicclassjava3publicstaticvoidmainString[]argsJFrameframe=newMouseFrame;frame.show;
本题的功能是监听键盘键的敲击并显示在窗口中importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;publicclassjava3extendsJFrameextendsKeyListenerprivateStringlinel=line2=;privateStringline3=;privateJTextAreatextArea;publicjava3superjava3;textArea=newJTextArea1015;textArea.setTextPressanykeyonthekeyboard...;textArea.setEnabledfalse;addKeyListenerthis;getContentPane.addtextArea;setSize350100;show;publicvoidkeyPressedKeyEventeline1=Keypressed+e.getKeyTexte.getKeyCode;setLines2and3e;publicvoidkeyReleasedKeyEventelinel=Keyreleased+e.getKeyTexte.getKeyCode;setLines2and3e;publicvoidkeyTypedKeyEventeLine1=Keytyped+e.getKeychar;setLines2and3e;privatevoidsetLines2and3KeyEventeline2=Thiskeyis+e.isActionKeynot+anactionkey;Stringtemp=e.getKeyModifiersTexte.getModifiers;line3=Modifierkeyspressed+temp.equalsnonetemp;textArea.setTextline1+n+line2+/n+line3+n;publicstaticvoidmainStringargs[]java3app=newjava3;addWindowListenernewWindowadapterlpublicvoidwindowClosingWindowEventeSystem.exit0;;
本题将数组arrA中的元素按逆序存储在另外一个相同长度的数组arrB中publicclassjava1publicstaticvoidmainString[]argsint[]arrA=138426907;int[]arrB=______;inti=0;intj=______;fori=0;i<arrA.length;i++arrB[j]=arrA[i];______;System.out.printlnarrA+arrB;fori=0;i<arrA.length;i++System.out.printlnarrA[i]++arrB[i];
______是窗体上用于显示数据执行操作装饰窗体的对象
本题要求分行打印输出当前系统中所有字体的名称______;publicclassjava2publicstaticvoidmainString[]argsString[]fontNames=GraphicsEnvironment.getLocalGraphicsEnvironment.getAvailableFontFamilyNames;forinti=0;______;i++System.out.printlnfontNames[i];
关系中能够唯一标识某个记录的字段称为______字段
本题是一个表格式的成绩单其中包括姓名英语成绩数学成绩和总成绩姓名和成绩都可以进行修改单击按钮计算每人总成绩则可以统计出每个人的总成绩并显示在总成绩栏中importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;publicclassjava2extendsJFrameimplementsActionListenerJTabletable;Objecta[][];Objectname[]=姓名英语成绩数学成绩总成绩;JButtonbutton;java2setTitlejava2;a=newObject[8][4];forinti=0;i<8;i++forintj=0;j<4;j++ifj!=0a[i][j]=;elsea[i][j]=;button=newJButton计算每人总成绩;table=______;button.addActionListenerthis;getContentPane.addnewJScrollPanetableBorderLayout.CENTER;getContentPane.addbuttonBorderLayout.SOUTH;setSize400200;setVisibletrue;validate;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;publicvoidactionPerformedActionEventeforinti=0;i<8;i++doublesum=0;booleanboo=true;forintj=1;j<=2;j++trysum=sum+Double.parseDouble______;catchExceptioneeboo=false;table.repaint;ifboo==truea[i][3]=+sum;table.repaint;publicstaticvoidmainStringargs[]java2Win=newjava2;
本题求一个实数37.13的整数部分和小数部分并打印输出publicclassjava1publicstaticvoidmainString[]args______d=37.13;inti;______;doublex;______;System.out.printlnd+整数部分+i+小数部分+x;
本题的功能是展示4种不同的对话框窗口中有4个按钮消息输入确定和选择单击任意一个按钮就能弹出一个对应的对话框其中消息对话框只有一个提示信息和一个确定按钮输入对话框有一个供输入的文本框及确定和撤销两个按钮确定对话框中有一个提示信息和三个按钮是否和撤销而选择对话框中有一个提示信息和两个按钮确定和取消importjavax.swing.*;importjava.awt.event.*;importjava.awt.*;publicclassjava3extendsJFrameimplementsButtonSelecteActionListenerJButtonbtnMessage=newJButton消息;JButtonbtnInput=newJButton输入;JButtonbtnConfirm=newJButton确认;JButtonbtnOption=newJButton选择;publicjava3superjava3;btnMessage.addActionListenerthis;btnInput.addActionListenerthis;btnConfirm.addActionListenerthis;btnOption.addActionListenerthis;getContentPane.setLayoutnewFlowLayout;getContentPane.addbtnMessage;getContentPane.addbtnInput;getContentPane.addbtnConfirm;getContentPane.addbtnOption;addWindowListenernewWindowAdapterpublicvoidwindowClosingWindowEventeSystem.exit0;;publicstaticvoidmainStringargs[]java3fr=newjava3;fr.pack;fr.setVisibletrue;PublicvoidactionperformedActionEventeObject[]opt=确认取消;JButtoninstance=JButtone.getObject;ifinstance==btnMessageJOptionPane.sbowMessageDialogthis消息对话框;elseifinstance==btnInputJOptionPane.showInputDialogthis输入对话框;elseifinstance==btnConfirmJOptionPane.showConfirmDialogthis确认对话框;elseJOptionPane.showOptionDialogthis选择对话框选择JOptionPane.YES_OPTIONJOptionPaneQUESTION_MESSAGEnulloptopt[1];
本题中用表格表现某个月的月历其中标题是从Sunday到Saturday表格中的各项是可以修改的importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjavax.swing.table.*;publicclassjava2publicstaticvoidmainString[]argstryUIManager.setLookAndFeeIUIManager.getSystemLookAndFeelClassName;catchExceptioneJFrameframe=newCalendarTableFrame;frame.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE;frame.show;classCalendarTableFrameextendsJFrameprivatestaticfinalintWIDTH=500;privatestaticfinalintHEIGHT=150;private______cells=nullnullnullnewInteger1newInteger2newInteger3newInteger4newInteger5newInteger6newInteger7newInteger8newInteger9newInteger10newInteger11newInteger12newInteger13newInteger14newInteger15newInteger16newInteger17newInteger18newInteger19newInteger20newInteger21newInteger22newInteger23newInteger24newInteger25newInteger26newInteger27newInteger28newInteger29newInteger30newInteger31null;privateString[]columnNames=SundayMondayTuesdayWednesdayThursdayFridaySaturday;publicCalendarTableFramesetTitlejava2;setSizeWIDTHHEIGHT;JTabletable=new______;getContentPane.addnewJScrollPanetableBorderLayout.CENTER;
热门题库
更多
法宣在线考试
司法卷一
司法卷二
司法卷三
司法卷四
企业法律顾问资格考试
“十三五”规划继续教育
潜力激活与创造力开发继续教育
创新创业能力继续教育
科研方法与论文写作继续教育
全面深化改革实现文明发展
提高自身绩效路径与方法
互联网监管与网络道德建设
“互联网+”和电子商务继续教育
职业道德素养继续教育
加强和创新网络道德教育