host != null ? new InetSocketAddress(host, port) :
     new InetSocketAddress(InetAddress.getByName(null), port),
     new InetSocketAddress(0), true);
帮忙解决一下!谢谢大家

解决方案 »

  1.   

    host != null ? new InetSocketAddress(host, port) :
    new InetSocketAddress(InetAddress.getByName(null), port),
    new InetSocketAddress(0), true);
    相当于 if(host != null)
    {
    new InetSocketAddress(host, port)
    }
    else
    {
    new InetSocketAddress(InetAddress.getByName(null), port),
    new InetSocketAddress(0), true)
    }
      

  2.   

    <表达式> ? <代码1> : <代码2>;如果<表达式>的值为true,则执行<代码1>
    如果<表达式>的值为false,则执行<代码2>
      

  3.   

    相当于 if(host != null)
    {
    host - new InetSocketAddress(host, port)
    }
    else
    {
    host = new InetSocketAddress(InetAddress.getByName(null), port),
    new InetSocketAddress(0), true)
    }
      

  4.   

    host = new InetSocketAddress(host, port);
      

  5.   

    不会吧?这可是java最基本的东西啊?赶快看书吧!
      

  6.   

    表达式> ? <代码1> : <代码2>;如果<表达式>的值为true,则执行<代码1>
    如果<表达式>的值为false,则执行<代码2>
      

  7.   

    this() 方法有3个参数
    1.--!=null?new InetSocketAddress(host, port):new InetSocketAddress(InetAddress.getByName(null), port)
    2.--new InetSocketAddress(0)
    3.-true.各位我说的对吗????
    但this() 这个方法是什么意思?呵呵 新手!
      

  8.   

    条件语句的另一种写法,一般用在简单的程序里,复杂的还是用IF ELSE吧
      

  9.   

    ustcfrank(勇敢的心 http://www.java99.com/)   同意
      

  10.   

    三目运算符
    如果条件为true则取冒号之前否则取之后
      

  11.   

    <表达式> ? <代码1> : <代码2>;
    --------------------------------
    表达式真
    执行:代码1;
    ================
    表达式非真
    执行:代码2;