题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-02 21:19:23

[简答题]阅读以下程序代码,写出程序的输出结果。
import java. util.*;
public class Class36

public static void main(String[] args)

String s1="public static void,main(String[] args)";
StringTokenizer s2=new StringTokenizer(s1,",( )[]");
int n=s2. countTokens( );
System. out. println (n);
while(s2. hasMoreTokens( ))
System. out. println(s2. nextToken ( ));


更多"阅读以下程序代码,写出程序的输出结果。 import java. u"的相关试题:

[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class35

public static void main(String[] args)

String s1=new String("0860371"),s2="0860371";
System. out. println(s1==s2);
System. out. println(s1. equals(s2));
System. out. println(s1. endsWith(s2)==s1. startsWith(s2));


[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class32

public static void main(String[] args)

boolean x=true,y=false,z=false;
x=x&&y||z;
y=x||y&&z;
z=!(x!=y)||(y==z);
System. out. println(x+","+y+","+z);


[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class33

public static void main(String[] args)

int a,b,c;
a=b=c=1;
boolean w;
w=a++>1&&++b>c++:
System. out. println(a+","+b+","+c+","+w);


[简答题]阅读下列程序,写出程序功能。
import javax. swing.*;
public class C3501

public static void main(String[] args)

JFrame myWin=new JFrame("C3501");
myWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar jmb=new JMenuBar( );
myWin. setJMenuBar(jmb);
myWin.setBounds(100,200,300,300);
JMenu jm=new JMenu("AAA");
jmb.add(jm);
JMenuItem jmi=new JMenuItem("AA1");
jm.add(jmi);
JMenu jm2=new JMenu("AA2");
jm. add(jm2);
JMenuItem jmi2=new JMenuItem("AA21");
jm2. add(jmi2);
myWin.setVisible(true);


[简答题]阅读以下程序代码,写出程序的功能。
public class Class34

public static void main(String[] args)

int a=1,b;
while(a<=9)

b=1;
while(b<=a)

System. out. print(" "+a+"×"+b+"="+a*b);
b++;

System. out. println( );
a++;



[简答题]阅读下列程序,请写出该程序的功能。
import java. io.*;
public class Class35

public static void main(String[] args)

try

RandomAccessFile file=null;
file=newRandom AccessFile("Class35.java","r");
long fileCurPos=0;
long fileLength=file.length( );
while(fileCurPos<fileLength)

String s=file. readLine( );
System. out. println(s);
fileCurPos=file. getFilePointer( );

file. close( );

catch(FileNotFoundException e1)

System.out.println("文件找不到!"+e1);

catch(IOException e2)

System.out. println("文件读写错!"+e2);



[填空题]阅读以下程序,输出结果为_______。  import java.iO.*;  public class abc    public static void main(Stringargs[])    String sl="Hello!";  String s2=new String("I like Java!");  System.out.println(s1+""+s2);
[简答题]阅读下列程序,请写出该程的功能。
import java. io. *;
public class Class34

public static void main(String[] args)

File inputFile=new File("file1.txt");
File outputFile=new File("file2. txt");
int ch;
try

FileReader in=new FileReader(inputFile);
FileWriter out=new FileWriter(outputFile);
while((ch=in. read( ))!=-1)out.write(ch);
in.close( );out. close( );

catch(FileNotFoundException e1)
System. out. println("文件没有找到!"+e1);
catch(IOException e2)
System. out. println("File read Error!"+e2);


[填空题]阅读以下程序,请写出输出结果_________   public class EqualsMethod{   public static void main (String[]args){   Integer nl=new Integer (47):   Integer n2=new Integer (47);   System.out.println(n1.equals(n2));   }
[填空题]阅读以下程序,请写出输出结果_________  public class EqualsMethod  public static void main (String[]args)  Integer nl=new Integer (47):  Integer n2=new Integer (47);  System.out.println(n1.equals(n2));  

[填空题]写出下面程序的运行结果 【15】 import java.io.*; public class abc { public static void main(String args[]) { String s1="Hello!"; String s2=new String("World!"); System.out.println(s1.concat(s2)); } }
[单项选择]阅读下面程序
import javax.swing.JOptionPane;
public class BreakLabelTest
public static void main( String args[] )
String output="";
stop:
for (int row=1; row<=10; row++)
for (int column=1; column<=5; column++ )
if ( row=5 )
break stop;
output+="* ";

output +="/n";

output +="/nLoops terminated normally";

JOptionPane.showMessageDiaiog(
null, output,"用一个标志测试break语句",
JOptionPane.INFORMATION_MES SAGE );
System.exit( 0 );


程序运行结果是( )。
A. 窗口中有5行*****
B. 窗口中有5行****
C. 窗口中有4行*****
D. 窗口中有6行*****
[单项选择]请阅读下面程序
import java.io;
public class TypeTransition
pubic static void main (String args[])
char a=’a’;
int i=100;
long y=456L;
int aa=a+i;
long yy=y-aa;
System.out.print("aa="+aa);
System.out.print("yy ="+yy);


程序运行结果是______。
A. aa=197 yy=259
B. aa=177 yy=259
C. aa=543 yy= 288
D. aa=197 yy=333
[简答题]

阅读下列程序,请写出该程序的输出结果。
class Test33 {
static int merger(int [] a, int []b, int []c){
int i = 0, j = 0, k = 0;
while(i < a.length && j < b.length) {
if(a[i] < b[j])c[k++] = a[i++];
else c[k++] = b[j++];
}
while(i < a.length) c[k++] = a[i++];
while(j < b.length) c[k++] = b[j++];
return k;
}
public static void main(String[] args) {
int a[] = {3, 6, 9};
int b[] = { 1, 2, 5};
int []c = new int[100];
int p = merger(a, b, c);
for(int k = 0; k < p; k++)
System.out.print(c[k]+ (k < p-1 " ":"/n"));
}


[单项选择]阅读下面程序
import javax.swing.JOptionPang;
public class BreakLabelTest
public static void main (String args[])
String output=" ";
stop:
for(int row=1; row<=10; row++)
for (int column=1; column<=5; column++)
if(row==5)
break stop;
output+=¨*¨;

output+="/n";

output+= "/nLoops terminated normally";

JOptionPane.showMes sageDialog(
Null, output,"用一个标志测试break语句",
JOptionPane.INFORMATION_MESSAGE);
System.exit(0);


程序运行结果是______。
A. 窗口中有5行*****
B. 窗口中有5行****
C. 窗口中有4行*****
D. 窗口中有6行*****
[单项选择]阅读下面程序
import javax.swing.JOptionPane;
public class Comparison
public static void main (String args[])
String firstNumber,//用户输入第1个数据变量
secondNumber,//用户输入第2个数据变量
result;//输出结果变量
int number1,//用于比较的第1个数
number2; //用于比较的第2个数
//用户输入第1个数据的字符串
firstNumber=JOptionPane.showInputDialob("输入第1个整数:");
//用户输入第2个数据的字符串
secondNumber=JOptionPane.showlnputDialog["输入第2个整数:");
//将字符串转换为整数类型
number1=Integer.parseInt(firstNumber);
number2=Integer.parseInt(secondNumber);
//初始化结果变量
______;
//比较两个数据
if (number1=number2)
result+=numberl+ "=="+number2;
if (number1! =number2)
result+=number1+"!="+number2;
if(number1<number2)
result=result+"n"+number1+"<"+number2;
if (number1>number2)
result=result+ "/n"+number1+ ">"+number2;
if(number1<=number2)
result=result+"/n"+number1+"<="+number2;
if(number1>=number2)
result=result+ "/n"+number1+">="+number2;
//显示结果

A. result=""
B. result=null
C. result=number1
D. result=number2
[简答题]阅读下列程序,请写出该程序的输出结果。
public class C

int x=10;
static int y=20;
public static void main(String[] args)

C obj1=new C( );
C obj2=new C( );
obj1.x*=2;
obj1.y*=3;
obj2.x+=4;
obj2.y+=5;
System. out. println(obj1.x);
System. out. println(obj1.y);
System. out. println(obj2.x);
System. out. println(obj2.y);


我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码