---
title: "联发科技笔试题"
author: "Eynjay"
date: "2011-09-23T10:20:37Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2011-09-23T10:20:37Z"
id: 1178763
url: "https://eynjay.iteye.com/blog/1178763"
---

public class Dims {

    /\**  
     * @param args  
     \*/  
    public static void main(String\[] args) {  
        // TODO Auto-generated method stub

        int\[]\[] a = {{1,2},{3,4}};  
        int\[] b = (int\[])a\[1];  
        Object o1 = a;  
        int\[]\[] a2 = (int\[]\[])o1;  
        int\[] b2 = (int\[])o1;  
        System.out.println(b\[1]);  
    }

}

运行时发生异常，在 int\[] b2 = (int\[])o1;处。类型不匹配

 

public class Pass {

    /\**  
     * @param args  
     \*/  
    public static void main(String\[] args) {  
        // TODO Auto-generated method stub

        int x = 6;  
        Pass p = new Pass();  
        p.doSth(x);  
        System.out.print(" main x = "+x);  
    }

    void doSth(int x){  
        System.out.print("doSth x = "+x++);  
    }  
}  
结果：

doSth x = 6 main x = 6