blob: ad89a505bc76f7d2c88d2cc68dccbe7d72fa8cd2 (
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
|
/*--------------------------------------------------------------------------*/
/* Name : N19990310_4.java */
/* : */
/* Cause : assignment operator makes error in char,byte,short variable */
/* : */
/* Message : In class `N19990310_4': */
/* : In method `main(java.lang.String[])': */
/* : Incompatible type for `='. Explicit cast needed to convert `*/
/* : `int' to `char'. */
/* : x += (x = 3); */
/* : ^ */
/* : 1 error */
/*--------------------------------------------------------------------------*/
public class N19990310_4 {
public static void main(String[] args) {
char x = 9;
x += (x = 3);
if ( x == 12 ) {
System.out.println("OK");
} else {
System.out.println("NG");
}
}
}
|