当前位置:七七学习网文档大全求职指南求职笔试面试笔试题目程序设计相关岗位笔试题目» 正文

程序设计相关岗位笔试题目

[10-10 21:21:19]   来源:http://www.77xue.com  笔试题目   阅读:8569
概要: public static void main(String[] args) { String str1 = new String("A"); String str2 = new String("B"); operateString(str1, str2); System.out.println("str1="+str1+",str2="+str2); int x=10; operateInt(x); System.out.println(x); StringBuffer str3 = new StringBuffer("A");
程序设计相关岗位笔试题目,标签:驾照笔试题目,腾讯笔试题目,http://www.77xue.com
public static void main(String[] args) {
  String str1 = new String("A");
  String str2 = new String("B");
  operateString(str1, str2);
  System.out.println("str1="+str1+",str2="+str2);
  int x=10;
  operateInt(x);
  System.out.println(x);
  
  StringBuffer str3 = new StringBuffer("A");
  StringBuffer str4 = new StringBuffer("B");
  operateStringBuffer(str3, str4);
  System.out.println("str3="+str3+",str4="+str4);
  
  testOperator();
}

public static void operateString(String a, String b){
  a.concat(b);
  b=a;
}

public static void operateInt(int x){
  x = x+100;
}

public static void operateStringBuffer(StringBuffer a, StringBuffer b){
  a.append("B");
  b=a;
}

输出结果为:  A, B, 10, AB, B.  此题给出了正解。

5、 String 类型的变量也支持重载符: “+=”。



6、  编程题, 实现 归并排序算法:

public class MergeSort2 {

public int[] sort(int[] data) {
        int[] temp=new int[data.length];
        mergeSort(data,temp,0,data.length-1);
        return data;
    }
   
    private void mergeSort(int[] data,int[] temp,int l,int r){
        int mid=(l+r)/2;
        System.out.println(l+", "+mid+", "+r);
        if(l==r) return ;
        
        mergeSort(data,temp,l,mid);
        mergeSort(data,temp,mid+1,r);
        for(int i=l;i<=r;i++){
        System.out.println("i="+i);
            temp[i]=data[i];
        }
        int i1=l;
        int i2=mid+1;

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


Tag:笔试题目驾照笔试题目,腾讯笔试题目求职指南 - 求职笔试面试 - 笔试题目
联系我们 | 网站地图 | 范文大全 | 管理知识 | 教学教育 | 作文大全 | 语句好词
Copyright http://www.77xue.com--(七七学习网) All Right Reserved.
1 2 3 4 5 6 7 8 9 10