试题答案

3773考试网计算机等级考试试题答案正文

2014计算机二级考试JAVA上机试题及答案5

来源:2exam.com 2014-3-5 8:55:16

一、基本操作题  
  本题是判断一个字符串“Tom”是否在另外一个字符串 “I am Tom,I am from China”中出现。  
  public class javal{ 
  public static void main(String[]args){ 
           ;  
  strl="I am Tom,I am from China.";  
  str2="Tom";  
  int i=         ;  
  if(         ) 
  System.out.println("\"+str2+"\"is in the 
  string:\""+strl+"\"");  
  else 
  System.out.println("\""+str2+"\"is not in the 
  string:\""+strl+"\"");  
  }  
  } 
  二、简单应用题  
  本题要求分行打印输出当前系统中所有字体的名称。  
           ;  
  public class java2 
  { 
  public static void main(String[]args) 
  { 
  String[]fontNames=GraphicsEnvironment 
  .getLocalGraphicsEnvironment().getAvailable- 
  FontFamilyNames();  
  for(int i=0;          ;i++) 
  System.Out.println(fontNames[i]);  
  } 
  }   

[1] [2] [3] 下一页

触屏版 电脑版
3773考试网 琼ICP备12003406号-1