简体   繁体   中英

can't figure out mistake in a for loop

I'm trying to run this loop ,but i keep getting an error :

identifier expected

'.class' expected

both on line 4

public static void main(String[] args) {
            int[] x = {98, 30, 97, 10, 5};
            int[] y = new int[5];
            for (int i = 0, int j = 4 ; i <= 4 && j >= 0; i++,j-- ) 
            {
            System.out.print(x[i]);

            }
        }

类型声明在for循环初始化表达式中仅允许一次

for (int i = 0, j = 4; i <= 4 && j >= 0; i++, j--)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM