+ 5

Confused...java array using ternary

how do i print 2 elements seprate without them adding when the statment returns false to (j<8)? The print has been casted to char, l is print for(int i = x.length,j=-7;i>j;++j) { l(j<8?x[8]:x[3] , x[5] ; //<just this part after : } thanks

9th Oct 2017, 5:36 PM
D_Stark
D_Stark - avatar
2 Réponses
+ 3
Maybe something like this : System.out.println(j<8?x[8]:x[3]+""+x[5]);
9th Oct 2017, 6:12 PM
LukArToDo
LukArToDo - avatar
+ 2
thanks but i didnt want to use println() as i have casted println method from string to char
9th Oct 2017, 6:51 PM
D_Stark
D_Stark - avatar