package com.chongrui.test;
//测试全局变量及局部变量的输出结果的异同
public class Gess {
static int times = 1;
public static void main (String[] args){
int times = 4;
int times2 = 8;
int z = times< times2?120:22;
System.out.println("输出三目运算的值"+z);
System.out.println("输出全局变量"+Gess.times);
System.out.println("输出局部变量"+times);
}
}
输出三目运算的值120
输出全局变量1
输出局部变量4
如果int z = times>times2?120:22; 输出的值是22