zoukankan      html  css  js  c++  java
  • 一个容易犯错的java题。

    //输出结果是什么系列


    class ValHold{
            
    public int i = 10;
        }

     
        
    public class ObParm{
        
    public static void main(String argv[]){
            ObParm o 
    = new ObParm();
            o.amethod();
            }

            
    public void amethod(){
                    
    int i = 99;
                    ValHold v 
    = new ValHold();
                    v.i
    =30;
                    another(v,i);
                    System.out.println(v.i);
            }
    //End of amethod
     
            
    public void another(ValHold v, int i){
                    i
    =0;
                    v.i 
    = 20;
                    ValHold vh 
    = new ValHold();
                    v 
    =  vh;
                    System.out.println(v.i
    + " "+i);
            }
    //End of another
     
        }

       1) 10,0, 30

       2) 20,0,30

       3) 20,99,30

       4) 10,0,20

    答案
  • 相关阅读:
    wcf常用的概念
    WebApi初探之路由配置
    NuGet Package Manager 实用命令
    WebApi初探之基本操作(CRUD)
    Excel操作类
    在Runbook中添加Checkpoint-workflow
    总结PowerShell的常用命令
    alt text 与 tooltip区别
    IFrame 获取内容
    WP8.1 实现Continuation程序(打开文件,保存文件等)
  • 原文地址:https://www.cnblogs.com/zxsoft/p/1045911.html
Copyright © 2011-2022 走看看