int a = 123;
int b = 132;
int c = 213;
System.out.println(a > (b>c ? b:c) ? a : (b>c? b:c));怎么打印最大的数是“c”基础学多久 2个月够吗

解决方案 »

  1.   

    a > (b>c ? b:c) ? a : (b>c? b:c)先判断: b>c 结果为c然后比较a>c? 结果为(b>c? b:c) , 即C
      

  2.   

    System.out.println(a > (b>c ? b:c) ? "a" : (b>c? "b":"c"));
      

  3.   

    做什么事情 根基最重要,时刻要注意,我学编程都1年半了 ,还在看基础的东西,基础打牢了,以后学啥技术都好办,你的问题问得不咋地,让人不知道如何给你答案, 
    public class Test{     public static void main(String[] args){        int a = 123;
            int b = 132;
            int c = 213;          System.out.println("c的值是:");
            System.out.print(a > (b>c ? b:c) ? a : (b>c? b:c));
            System.out.println("打印字符C");
            System.out.println(a > (b>c ? b:c) ? "a" : (b>c? "b":"c"));
         }
    }
      

  4.   

    System.out.println(
    a >= b && a >= c ? 'a' :
    b >= a && b >= c ? 'b' :
    'c'
    );
      

  5.   

    int manx=a;
    if(b>max)
    max=b;
    if(c>max)
    max=c;
    System.out.println(max);
      

  6.   

    这种吃力不讨好的事,让反射去做吧
    import java.lang.reflect.Field;
    import java.util.Arrays;
    import java.util.Comparator;public class Test {
        int aVar = 123;
        int bTem = 132;
        int cGoooo = 213; // 名字随便取,不限于a, b, c    public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException {
            final Test t = new Test();
            Field[] fields = Test.class.getDeclaredFields();
            
            Arrays.sort(fields, new Comparator<Field>() {
                @Override
                public int compare(Field f1, Field f2) {
                    try {
                        return f2.getInt(t) - f1.getInt(t);
                    } catch (IllegalArgumentException e) {
                        e.printStackTrace();
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    }
                    return 0;
                }
            });        // 打印出整数值最大的变量的名字
            System.out.println(fields[0].getName());
        }
    }
      

  7.   

    public class test{
      public static void main(String []args){
             test t=new test();
             int result=t.m1(123,132,213);
             System.out.println(result);
      }
    public int m1(int a,int b,int c){
            int max;
               if(a>b)
                    if(a>c)
                         max=a;
              else
              max=c;
              else
                   if(b>c)
                       max=b;
                  else
                     max=c;
           return max;
     }
    }
      

  8.   

    System.out.println("最大数是"+(a > (b>c ? b:c) ? "a" : (b>c? "b":"c")));用这个语句就可以搞定了。
      

  9.   


    1.这样就可以打印出c:
                    int a = 123;
    int b = 132;
    int c = 213;
    System.out.println(a > (b>c ? b:c) ? "a" : (b>c? "b":"c"));
    2.因人而异,看你对这段代码的理解,2个月明显不够