blob: 61ccc5b9f3a3169e5a010a67e807ee8ea2c34a74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/*--------------------------------------------------------------------------*/
/* Name : N19990310_5.java */
/* : */
/* Cause : A assignment operator makes error in char,byte,short array */
/* : element */
/* : */
/* Message : In class `N19990310_5': */
/* : In method `main(java.lang.String[])': */
/* : Incompatible type for `='. Explicit cast needed to convert `*/
/* : `int' to `char'. */
/* : a[0] += (a[0] = 3); */
/* : ^ */
/* : 1 error */
/*--------------------------------------------------------------------------*/
public class N19990310_5 {
public static void main(String[] args) {
char[] a = {9};
a[0] += (a[0] = 3);
if ( a[0] == 12 ) {
System.out.println("OK");
} else {
System.out.println("NG");
}
}
}
|